Only make necessary system calls.
[mLib] / bits.h
diff --git a/bits.h b/bits.h
index 4f8b582..4618589 100644 (file)
--- a/bits.h
+++ b/bits.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: bits.h,v 1.9 2001/01/20 12:05:20 mdw Exp $
+ * $Id$
  *
  * Portable bit-level manipulation macros
  *
  * MA 02111-1307, USA.
  */
 
-/*----- Revision history --------------------------------------------------* 
- *
- * $Log: bits.h,v $
- * Revision 1.9  2001/01/20 12:05:20  mdw
- * New hack for storing 64-bit numbers in tables.
- *
- * Revision 1.8  2000/10/08 11:06:30  mdw
- * Shut later versions of GCC up about use of @long long@.
- *
- * Revision 1.7  2000/07/22 09:48:26  mdw
- * Added macros for reading 64-bit values.
- *
- * Revision 1.6  2000/07/16 12:28:28  mdw
- * Add 64-bit support, with faked arithmetic on 32-bit hosts.
- *
- * Revision 1.5  2000/06/17 10:36:06  mdw
- * Support for 24-bit types.
- *
- * Revision 1.4  1999/12/10 23:42:04  mdw
- * Change header file guard names.
- *
- * Revision 1.3  1999/06/20 23:31:52  mdw
- * More portability enhancements.
- *
- * Revision 1.2  1999/06/17 00:12:46  mdw
- * Improve portability for shift and rotate macros.
- *
- * Revision 1.1  1999/06/01 09:46:19  mdw
- * New addition: bit manipulation macros.
- *
- */
-
 #ifndef MLIB_BITS_H
 #define MLIB_BITS_H
 
@@ -249,12 +217,15 @@ typedef unsigned char octet;
      unsigned _s = (s) & 63u;                                          \
      uint32 _l = (v).lo, _h = (v).hi;                                  \
      kludge64 *_d = &(d);                                              \
-     if (_s >= 32) {                                                   \
+     if (_s > 32) {                                                    \
        _d->hi = LSL32(_l, _s - 32u) | LSR32(_h, 64u - _s);             \
        _d->lo = LSL32(_h, _s - 32u) | LSR32(_l, 64u - _s);             \
      } else if (!_s) {                                                 \
        _d->lo = _l;                                                    \
        _d->hi = _h;                                                    \
+     } else if (_s == 32) {                                            \
+       _d->lo = _h;                                                    \
+       _d->hi = _l;                                                    \
      } else {                                                          \
        _d->hi = LSL32(_h, _s) | LSR32(_l, 32u - _s);                   \
        _d->lo = LSL32(_l, _s) | LSR32(_h, 32u - _s);                   \
@@ -264,12 +235,15 @@ typedef unsigned char octet;
      unsigned _s = (s) & 63u;                                          \
      uint32 _l = (v).lo, _h = (v).hi;                                  \
      kludge64 *_d = &(d);                                              \
-     if (_s >= 32) {                                                   \
+     if (_s > 32) {                                                    \
        _d->hi = LSR32(_l, _s - 32u) | LSL32(_h, 64u - _s);             \
        _d->lo = LSR32(_h, _s - 32u) | LSL32(_l, 64u - _s);             \
      } else if (!_s) {                                                 \
        _d->lo = _l;                                                    \
        _d->hi = _h;                                                    \
+     } else if (_s == 32) {                                            \
+       _d->lo = _h;                                                    \
+       _d->hi = _l;                                                    \
      } else {                                                          \
        _d->hi = LSR32(_h, _s) | LSL32(_l, 32u - _s);                   \
        _d->lo = LSR32(_l, _s) | LSL32(_h, 32u - _s);                   \