HEX64\$ OCT64\$ BIN64\$ Antoni Gual Posting Freak Posts: 1,407 Threads: 117 Joined: Dec 2002 04-15-2005, 03:29 PM To complement the new Longint type, here's a little lib including HEX64\$,OCT64\$ amd BIN64\$ functions... Code:```'BASE64 library by Antoni Gual  4/2005 ' Declare function bin64\$(num as longint) Declare function hex64\$(num as longint) Declare function oct64\$(num as longint) function bin64\$(num as longint) a\$=string\$(64,48) 'zero padded b\$=BIN\$(cint (num shr 32)and &hFFFFFFFF) mid\$(a\$,33-len(b\$))=b\$ b\$=BIN\$(cint (num and &hFFFFFFFF)) mid\$(a\$,65-len(b\$))=b\$ FUNCTION=a\$ end function function hex64\$(num as longint) a\$=string\$(16,48) 'zero padded b\$=hex\$(cint(num shr 32and &hFFFFFFFF)) mid\$(a\$,9-len(b\$))=b\$ b\$=hex\$(cint (num and &hFFFFFFFF)) mid\$(a\$,17-len(b\$))=b\$ FUNCTION=a\$ end function function oct64\$(num as longint) a\$=string\$(22,48)  'zero padded b\$=oct\$(cint(num shr 60)and &hf) mid\$(a\$,3-len(b\$))=b\$ b\$=oct\$(cint ((num and &hFFFFFFFC0000000)shr 30)) mid\$(a\$,13-len(b\$))=b\$ b\$=oct\$(cint (num and &h3FFFFFFF)) mid\$(a\$,23-len(b\$))=b\$ FUNCTION=a\$ end function``` Antoni jdebord Member Posts: 60 Threads: 8 Joined: Jan 2005 04-16-2005, 04:59 PM Thanks for these useful functions! Another suggestion: it would be nice to have the following declared somewhere: Code:```#define LONGINT_MAX    9223372036854775807   '  2^63 - 1 #define LONGINT_MIN   -9223372036854775808   ' -2^63 #define ULONGINT_MAX  18446744073709551615   '  2^64 - 1``` I did not find them in CRT.BI ean Debord ---------------- Math library for FreeBasic: http://www.unilim.fr/pages_perso/jean.de...fbmath.zip Antoni Gual Posting Freak Posts: 1,407 Threads: 117 Joined: Dec 2002 04-16-2005, 05:56 PM CRT.bi is perhaps not the right place, but they should be somewhere.. Antoni Z!re Posting Freak Posts: 3,522 Threads: 189 Joined: Dec 2003 04-16-2005, 05:59 PM Antoni, mind if I put that code up on plantasy for download? Antoni Gual Posting Freak Posts: 1,407 Threads: 117 Joined: Dec 2002 04-16-2005, 08:12 PM You are welcome! Antoni « Next Oldest | Next Newest »