--- libecb/ecb.h 2015/11/21 16:53:50 1.167 +++ libecb/ecb.h 2015/11/21 20:56:38 1.169 @@ -450,7 +450,7 @@ ecb_function_ ecb_const int ecb_ctz64 (uint64_t x) { - int shift = x & 0xffffffffU ? 0 : 32; + int shift = x & 0xffffffff ? 0 : 32; return ecb_ctz32 (x >> shift) + shift; } @@ -726,7 +726,7 @@ if (ecb_expect_true (0x477fefff < x && x <= 0x7f800000)) return s | 0x7c00; - /* handle zero and subnormals */ + /* handle zero, subnormals and small numbers */ if (ecb_expect_true (x < 0x38800000)) { /* zero */ @@ -735,6 +735,10 @@ /* handle subnormals */ + /* too small, will be zero */ + if (e < (14 - 24)) /* might not be sharp, but is good enough */ + return s; + m |= 0x00800000; /* make implicit bit explicit */ /* very tricky - we need to round to the nearest e (+10) bit value */