Changeset 1833


Ignore:
Timestamp:
Jan 7, 2012, 4:03:51 PM (8 years ago)
Author:
ksherdy
Message:

Added templated type.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/byte_compare.hpp

    r1831 r1833  
    3636template<class T, uint32_t L>
    3737IDISA_ALWAYS_INLINE bool overlap_compare(const T * x, const T * y) {
     38
     39    cout << sizeof(T) << endl;
     40
    3841    bool accum = true;
    39     uint8_t * p_x = (uint8_t *)x;
    40     uint8_t * p_y = (uint8_t *)y;
     42    T * p_x = (T *)x;
     43    T * p_y = (T *)y;
    4144
    4245    for(int i=0; i < L/sizeof(T); i++) {
    4346        accum = accum && compare(p_x,p_y,0);
    44         p_x += sizeof(T);
    45         p_y += sizeof(T);
     47        p_x++;
     48        p_y++;
    4649    }
    4750    if(L & (sizeof(T)-1)) {
     
    5356template<class T>
    5457IDISA_ALWAYS_INLINE bool compare(const T * x, const T * y, const uint32_t offset) {
    55  
     58    cout << sizeof(T) << endl;
    5659    return !((*((T*)((uint8_t *)x + offset))) ^
    5760             (*((T*)((uint8_t *)y + offset))));
Note: See TracChangeset for help on using the changeset viewer.