[clug] "Casting" in perl.

Andrew Janke a.janke at gmail.com
Mon Jun 22 12:25:55 GMT 2009


> What exactly are you trying to do?

Replicate what a C library has been doing with a hashing function
value... (warts and all).

> It would seem to be somewhat
> architecture specific since the relative sizes of int and long vary
> depending on the machine and compiler.

Aye, this was my concern. I am guessing that the original author
(of the C version) didn't quite catch the cast (it was not explicit in
the C version).

> However, if the goal is to truncate the value to 32 bits, try:
>
> $ui = $ul & 0xFFFFFFFF;

bah! I forgot about this even after just reading this a few days back:

   http://www.gamedev.net/reference/articles/article1563.asp

Thanks!


--
Andrew Janke
(a.janke at gmail.com || http://a.janke.googlepages.com/)
Canberra->Australia    +61 (402) 700 883


More information about the linux mailing list