Re: decimal value of unsigned long integer

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

EU>I'm stuck.
EU>Does anyone know how to calculate the decimal value of an unsigned long
EU>integer?
EU>I think it's four bytes long, and I know it has a different value from a
EU>long integer which is also four bytes long. I can get a value for long
EU>integers,  but nothing I've tried to calculate unsigned long integers works.

EU>Thanks

EU>Martin Hunt - simulat at intergate.bc.ca

Since it's unsigned, all 32 bits are used for a number (and bit 31 does
not represent whether the value is positive or negitive). The 32 bits
are stored as 4 bytes which are (with Intel processors) in order from least
significant to most significant. So this should work - just pass it the
four bytes.

function ulong2int(integer a, integer b, integer c, integer d)
        return a + (256 * b) + (65536 * c) + (16777216 * d)
end function

Jeffrey Fielding
JJProg at cyberbury.net
http://members.tripod.com/~JJProg/

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

Search



Quick Links

User menu

Not signed in.

Misc Menu