Changeset 2139 for trunk


Ignore:
Timestamp:
May 23, 2012, 4:05:15 PM (7 years ago)
Author:
ksherdy
Message:

Added alignement checks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/symbol_table/src/buffer.hpp

    r2134 r2139  
    1111#define PADDING_BLOCKS 0
    1212#define PADDING_SIZE (BLOCK_SIZE * PADDING_BLOCKS)
    13 #define COPYBACK_BLOCKS 2
     13#define COPYBACK_BLOCKS 1
    1414#define COPYBACK_SIZE (BLOCK_SIZE * COPYBACK_BLOCKS)
    15 #define SEGMENT_BLOCKS  4
     15#define SEGMENT_BLOCKS  15
    1616#define SEGMENT_SIZE (BLOCK_SIZE * SEGMENT_BLOCKS)
    1717#define BUFFER_SIZE (COPYBACK_SIZE + SEGMENT_SIZE + PADDING_SIZE)
     
    2828///////////////////////////////////////////////////////////////////////////
    2929#define ALLOC_STATIC_ALIGNED_BYTE_BUFFER(copyback, base) \
    30         BitBlock aligned_##base[BUFFER_SIZE]; \
     30        ATTRIBUTE_SIMD_ALIGN BitBlock aligned_##base[BUFFER_SIZE]; \
    3131        assert_bitblock_align((void*)aligned_##base);\
    3232        copyback = (uint8_t *)aligned_##base; \
     
    3535
    3636#define ALLOC_STATIC_ALIGNED_BITBLOCK_BUFFER(copyback, base) \
    37         BitBlock aligned_##base[BUFFER_SIZE/8]; \
     37        ATTRIBUTE_SIMD_ALIGN BitBlock aligned_##base[BUFFER_SIZE/8]; \
    3838        assert_bitblock_align((void*)aligned_##base);\
    3939        copyback = (BitBlock *) aligned_##base; \
     
    4242
    4343#define COPY_BACK_BYTE_BUFFER(copyback, base) \
    44 do {    memmove(copyback,(uint8_t *)base + (SEGMENT_SIZE - COPYBACK_SIZE), COPYBACK_SIZE);\
     44do {    void * src = copyback;\
     45        void * dest = (uint8_t *)base + (SEGMENT_SIZE - COPYBACK_SIZE);\
     46        assert_bitblock_align(src);\
     47        assert_bitblock_align(dest);\
     48        memmove(src, dest, COPYBACK_SIZE);\
    4549} while(0)
    4650
    4751#define COPY_BACK_BITBLOCK_BUFFER(copyback, base) \
    48 do {    memmove(copyback,&((uint8_t *)base)[(SEGMENT_SIZE-COPYBACK_SIZE)/8],COPYBACK_SIZE/8);\
     52do {    void * src = copyback;\
     53        void * dest = (uint8_t *)base + ((SEGMENT_SIZE - COPYBACK_SIZE)/8);\
     54        assert_bitblock_align(src);\
     55        assert_bitblock_align(dest);\
     56        memmove(src, dest, COPYBACK_SIZE/8);\
    4957} while(0)
    5058
Note: See TracChangeset for help on using the changeset viewer.