diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2001-06-01 15:49:43 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2001-06-01 15:49:43 +0000 |
commit | ee9080d232f3ce041edfcaceed0e70ee07416a47 (patch) | |
tree | 8cc5c228951f32c6aa30cec28f99172a9ddd34e7 /lib/gnutls_num.h | |
parent | 6208151d0f987929d19ac04bfdaeaceca821bd66 (diff) | |
download | gnutls-ee9080d232f3ce041edfcaceed0e70ee07416a47.tar.gz |
gnutls now handles uint64 even in systems without a native one.
several bug fixes.
Diffstat (limited to 'lib/gnutls_num.h')
-rw-r--r-- | lib/gnutls_num.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/gnutls_num.h b/lib/gnutls_num.h index 12842f88fe..1ebbf0771a 100644 --- a/lib/gnutls_num.h +++ b/lib/gnutls_num.h @@ -18,17 +18,30 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ +#include <gnutls_int.h> + uint32 uint24touint32( uint24 num); uint24 uint32touint24( uint32 num); uint32 READuint32( const opaque* data); uint16 READuint16( const opaque* data); uint32 CONVuint32( uint32 data); uint16 CONVuint16( uint16 data); -uint16 READuint64( const opaque* data); -uint32 CONVuint64( uint64 data); +uint8* CONVuint64( const uint64 *data); /* note: this returns malloced data */ uint32 READuint24( const opaque* data); void WRITEuint24( uint32 num, opaque* data); void WRITEuint32( uint32 num, opaque* data); void WRITEuint16( uint16 num, opaque* data); -void WRITEuint64( uint64 num, opaque* data); +uint32 uint64touint32( const uint64*); + +#ifndef HAVE_UINT64 +int uint64zero( uint64 *); +int uint64pp( uint64 *); +#else + +# define rotl64(x,n) (((x) << ((uint16)(n))) | ((x) >> (64 - (uint16)(n)))) +# define rotr64(x,n) (((x) >> ((uint16)(n))) | ((x) << (64 - (uint16)(n)))) +# define byteswap64(x) ((rotl64(x, 8) & 0x00ff00ff00ff00ffUL) | (rotr64(x, 8) & 0xff00ff00ff00ff00UL)) +# define uint64pp(x) (*x)++ +# define uint64zero(x) (*x) = 0 +#endif |