Ignore:
Timestamp:
May 24, 2012, 5:30:08 PM (7 years ago)
Author:
ksherdy
Message:

Add align assertion routines to bitblock.hpp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/bitblock.hpp

    r2135 r2152  
    4343static IDISA_ALWAYS_INLINE BitBlock mask_reverse_zeroes(uint32_t count);
    4444static IDISA_ALWAYS_INLINE uint32_t bitstream_scan(BitBlock * v, uint32_t pos);
    45 static IDISA_ALWAYS_INLINE void assert_bitblock_align(void * addr);
    46 static IDISA_ALWAYS_INLINE void assert_bitblock_align(BitBlock v);
    4745
    4846/*  BitBlock union type */
     
    117115}
    118116
     117static IDISA_ALWAYS_INLINE void assert_bitblock_align(void * addr) {
     118    assert(0 == ((unsigned long long)(addr) & (sizeof(BitBlock)-1)));
     119}
     120
     121static IDISA_ALWAYS_INLINE void assert_bitblock_align(BitBlock v) {
     122    assert(0 == ((unsigned long long)(&v) & (sizeof(BitBlock)-1)));
     123}
     124
     125#define ASSERT_BITBLOCK_ALIGN(v) assert_bitblock_align(v)
     126
    119127#endif // BITBLOCK_HPP
    120128
Note: See TracChangeset for help on using the changeset viewer.