groups

name language licence
64-bit Number from a String Perl Other
Convert a number to text Perl MIT



language: Perl
licence: Other

64-bit Number from a String

options: view full snippetsend to code collector
Useful for int64_t input parameters, like what CGEventSourceSetUserData needs

The string in the foreach() loop needs to have a length of 8
Probably doesn't work if your string contains wide characters

perl -MMath::BigInt -e '$x=Math::BigInt->bzero(); foreach(split(//,"Hi_There")){printf("$_\t%d\n",ord($_)); $x <<= 8;$x+=ord($_);} print "$x\n";'
	
(Continues...)