Print this page
5007142 Add ntohll and htonll to sys/byteorder.h
6717509 Need to use bswap/bswapq for byte swap of 64-bit integer on x32/x64
PSARC 2008/474

*** 18,36 **** * * CDDL HEADER END */ /* ! * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _MD5_BYTESWAP_H #define _MD5_BYTESWAP_H - #pragma ident "%Z%%M% %I% %E% SMI" - /* * definitions for inline functions for little-endian loads. * * This file has special definitions for UltraSPARC architectures, * which have a special address space identifier for loading 32 and 16 bit --- 18,34 ---- * * CDDL HEADER END */ /* ! * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _MD5_BYTESWAP_H #define _MD5_BYTESWAP_H /* * definitions for inline functions for little-endian loads. * * This file has special definitions for UltraSPARC architectures, * which have a special address space identifier for loading 32 and 16 bit
*** 38,49 **** --- 36,50 ---- * * This file and common/crypto/md5/sparc/sun4[uv]/byteswap.il implement the * same thing and must be changed together. */ + #include <sys/types.h> #if defined(__sparc) #include <v9/sys/asi.h> + #elif defined(_LITTLE_ENDIAN) + #include <sys/byteorder.h> #endif #ifdef __cplusplus extern "C" { #endif
*** 98,121 **** : "=r" (value) : "r" (addr), "i" (ASI_PL)); return (value); } - - static __inline__ uint16_t - load_little_16(uint16_t *addr) - { - uint16_t value; - - __asm__( - "lduha [%1] %2, %0\n\t" - : "=r" (value) - : "r" (addr), "i" (ASI_PL)); - - return (value); - } - #endif /* !__lint && __GNUC__ */ #if !defined(__GNUC__) extern uint32_t load_little_32(uint32_t *); #endif /* !__GNUC__ */ --- 99,108 ----
*** 127,143 **** { return (*addr); } #endif /* __lint */ ! #else /* !sun4u */ /* big endian -- will work on little endian, but slowly */ /* Since we do byte operations, we don't have to check for alignment. */ #define LOAD_LITTLE_32(addr) \ ((addr)[0] | ((addr)[1] << 8) | ((addr)[2] << 16) | ((addr)[3] << 24)) - #endif /* sun4u */ #if defined(sun4v) /* --- 114,131 ---- { return (*addr); } #endif /* __lint */ ! #elif defined(_LITTLE_ENDIAN) ! #define LOAD_LITTLE_32(addr) htonl(addr) + #else /* big endian -- will work on little endian, but slowly */ /* Since we do byte operations, we don't have to check for alignment. */ #define LOAD_LITTLE_32(addr) \ ((addr)[0] | ((addr)[1] << 8) | ((addr)[2] << 16) | ((addr)[3] << 24)) #endif /* sun4u */ #if defined(sun4v) /*