How can I convert Big-endian to Little-endian efficiently? How can I convert Big-endian to Little-endian efficiently? JLMartin (Programmer) (OP) 26 Oct 99 18:52 I have a several Long numbers that are stored in Big-endian and I want to convert then Little-endian. How can I do this efficiently? RE: How can I convert Big-endian to Little-endian efficiently? chiph (Programmer) 29 Oct 99 11:07 Hi JLMartin! Hmmm. Two methods come to mind: 1) Call the Winsock function htonl() or ntohl() depending on the direction you want to go 2) Do something ugly (but removes dependency on Winsock) like: Dim s1, s2, s3, s4 as byte s1 = (Num And &HFF000000) / &H01000000 s2 = (Num And &H00FF0000) / &H00010000 s3 = (Num And &H0000FF00) / &H00000100 s4 = Num And &H000000FF Num = (s4 * &H00100000) + (s3 * &H00010000) + (s2 * &H00000100) + s1 NOTE: I haven't tested this code - you might need to play around with the AND statements, but it looks good. Chip H.