I would $num >>= 16;
Both methods have problems on 32-bit systems.
GrandFather's produces the correct result and warnings, but yours gives the wrong result?
print 24600988483 / 2**32;; 5.72786398301832 print 24600988483 / 0x100000000;; Integer overflow in hexadecimal number at (eval 24) line 1 Hexadecimal number > 0xffffffff non-portable at (eval 24) line 1 5.72786398301832 print 24600988483 >> 16;; 65535
In reply to Re^3: String to Hex
by BrowserUk
in thread String to Hex
by augustpete
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |