Re: poke8 problems : 64-bit numbers in a 53-bit language

new topic     » goto parent     » topic index » view thread      » older message » newer message

I was getting numbers close to but not as big as 264. Give a value like 0xffff_ffff_ffff_f000, and that will go into memory as is and be peeked back in. So, I experimented with poking 0xffff_ffff_ffff_fc00 into memory and peeking from that place got me 0.

Now, the value is read by the scanner as a very large positive value. It is not until it is converted to a 64-bit int that it becomes 0. If the scanner were rounding it to 0, the following test would pass as 0 = 0. This happens completely inside do_poke8() in be_execute.c and has nothing to do with how peek8u works.

poke8( ptr, 0xffff_ffff_ffff_fc00 ) 
test_equal( "poke8/peek8u 54-bit number", 0xffff_ffff_ffff_fc00, peek8u( ptr ) ) 

The value is not rounded to something bigger than the biggest 64-big unsigned int because if it were the program would halt because of a limits test the value is put to before an attempt at conversion is made. Now the unsigned 64-bit int is big enough to hold the value.

Strange.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu