------- Comment #4 from barryb at cwipapps dot net  2006-06-15 17:15 -------
Sorry, you are right; you have to cast it twice.
I'd moved on to 

d is 32765.000000, as integer is 0x00007ffd, and (ushort)d is 0x7ffd while
(uchar)(ushort)d is 0xfd
d is 32766.000000, as integer is 0x00007ffe, and (ushort)d is 0x7ffe while
(uchar)(ushort)d is 0xfe
d is 32767.000000, as integer is 0x00007fff, and (ushort)d is 0x7fff while
(uchar)(ushort)d is 0xff
d is 32768.000000, as integer is 0x00008000, and (ushort)d is 0x8000 while
(uchar)(ushort)d is 0x00
d is 32769.000000, as integer is 0x00008001, and (ushort)d is 0x8001 while
(uchar)(ushort)d is 0x01
d is 32770.000000, as integer is 0x00008002, and (ushort)d is 0x8002 while
(uchar)(ushort)d is 0x02

Which works for this width of integer.

For some reason the following code 
 *to++= (char) (floor(my_rnd(&rand_st)*31)+64);
seems to work in MySQL 4.0.23 for Linux, but not when I use it.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28038

Reply via email to