Various fixes for Illumos Hipster 20151003.

This commit is contained in:
John Hood
2016-01-17 23:18:05 -05:00
parent dbbed24d83
commit 6fd570f81f
7 changed files with 62 additions and 65 deletions
+10 -10
View File
@@ -72,14 +72,14 @@
inline uint64_t htobe64( uint64_t x ) {
uint8_t xs[ 8 ] = {
( x >> 56 ) & 0xFF,
( x >> 48 ) & 0xFF,
( x >> 40 ) & 0xFF,
( x >> 32 ) & 0xFF,
( x >> 24 ) & 0xFF,
( x >> 16 ) & 0xFF,
( x >> 8 ) & 0xFF,
x & 0xFF };
static_cast<uint8_t>( ( x >> 56 ) & 0xFF ),
static_cast<uint8_t>( ( x >> 48 ) & 0xFF ),
static_cast<uint8_t>( ( x >> 40 ) & 0xFF ),
static_cast<uint8_t>( ( x >> 32 ) & 0xFF ),
static_cast<uint8_t>( ( x >> 24 ) & 0xFF ),
static_cast<uint8_t>( ( x >> 16 ) & 0xFF ),
static_cast<uint8_t>( ( x >> 8 ) & 0xFF ),
static_cast<uint8_t>( ( x ) & 0xFF ) };
union {
const uint8_t *p8;
const uint64_t *p64;
@@ -106,8 +106,8 @@ inline uint64_t be64toh( uint64_t x ) {
inline uint16_t htobe16( uint16_t x ) {
uint8_t xs[ 2 ] = {
( x >> 8 ) & 0xFF,
x & 0xFF };
static_cast<uint8_t>( ( x >> 8 ) & 0xFF ),
static_cast<uint8_t>( ( x ) & 0xFF ) };
union {
const uint8_t *p8;
const uint16_t *p16;
+3
View File
@@ -65,6 +65,9 @@ AlignedBuffer::AlignedBuffer( size_t len, const char *data )
: m_len( len ), m_allocated( NULL ), m_data( NULL )
{
#if defined(HAVE_POSIX_MEMALIGN)
if ( len == 0 ) {
len = 1;
}
if ( ( 0 != posix_memalign( &m_allocated, 16, len ) )
|| ( m_allocated == NULL ) ) {
throw std::bad_alloc();