Here goes a simple question: I need a function to convert an int to a byte.Either I'm not searching hard enough, or there is no such function in the prelude. Which is it?
--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/6fb403c5-b024-4c84-bca5-ec2c2dd48c04%40googlegroups.com.
Actually, $UN.cast may not be the exact function you want since I guess byte will have some views that need to be constructed, but something in $UN would hopefully work.
I added several casting functions for bytes. See the end of the following file:
http://ats-lang.sourceforge.net/DOCUMENT/ATS-Postiats/prelude/HTML/SATS/char_sats.html
The type byte is treated in ATS as a completely opaque type whose size equals that of a char.
If you want to manipulate/modify bytes, try to use types like int8 and uint8.
On Friday, February 13, 2015 at 10:43:30 PM UTC+6, gmhwxi wrote:I added several casting functions for bytes. See the end of the following file:
http://ats-lang.sourceforge.net/DOCUMENT/ATS-Postiats/prelude/HTML/SATS/char_sats.html
The type byte is treated in ATS as a completely opaque type whose size equals that of a char.Is there a praxi or prfun somewhere that indicates that sizeof(byte) == sizeof(char)?
praxi
lemma_char_size () : [sizeof(char)==sizeof(byte)] void
prval () = $UN.prop_assert{sizeof(char)==sizeof(byte)}()