diff --git a/src/misc.c b/src/misc.c index 22f8c12..e1f00a0 100644 --- a/src/misc.c +++ b/src/misc.c @@ -51,8 +51,7 @@ libssh2_ntohu32(const unsigned char *buf) /* }}} */ /* {{{ libssh2_ntohu64 - * Note: Some 32-bit platforms have issues with bitops on long longs - * Work around this by doing expensive (but safer) arithmetic ops with optimization defying parentheses + * */ libssh2_uint64_t libssh2_ntohu64(const unsigned char *buf) @@ -85,7 +84,7 @@ libssh2_htonu32(unsigned char *buf, unsigned long value) void libssh2_htonu64(unsigned char *buf, libssh2_uint64_t value) { - unsigned long msl = (value / 65536) / 65536; + unsigned long msl = ((libssh2_uint64_t)value >> 32); buf[0] = (msl >> 24) & 0xFF; buf[1] = (msl >> 16) & 0xFF;