Changeset 2594 for trunk


Ignore:
Timestamp:
Oct 30, 2012, 1:17:27 PM (6 years ago)
Author:
ksherdy
Message:

Rename scanword_t ScanWord?.

Location:
trunk/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/bitblock.hpp

    r2587 r2594  
    7070
    7171IDISA_ALWAYS_INLINE uint32_t count_forward_zeroes(BitBlock v) {
    72         union {BitBlock bitblock; scanword_t elems[sizeof(BitBlock)/sizeof(scanword_t)];} u;
     72        union {BitBlock bitblock; ScanWord elems[sizeof(BitBlock)/sizeof(ScanWord)];} u;
    7373        u.bitblock = v;
    7474        uint32_t so_far = 0;
    75         for (unsigned int i = 0; i < sizeof(BitBlock)/sizeof(scanword_t); i++) {
     75        for (unsigned int i = 0; i < sizeof(BitBlock)/sizeof(ScanWord); i++) {
    7676                if (u.elems[i] != 0) return so_far | scan_forward_zeroes(u.elems[i]);
    77                 so_far += 8 * sizeof(scanword_t);
     77                so_far += 8 * sizeof(ScanWord);
    7878        }
    7979        return so_far;
     
    8686
    8787IDISA_ALWAYS_INLINE uint32_t count_reverse_zeroes(BitBlock v) {
    88         union {BitBlock bitblock; scanword_t elems[sizeof(BitBlock)/sizeof(scanword_t)];} u;
     88        union {BitBlock bitblock; ScanWord elems[sizeof(BitBlock)/sizeof(ScanWord)];} u;
    8989        u.bitblock = v;
    9090        uint32_t so_far = 0;
    91         for (unsigned int i = (sizeof(BitBlock)/sizeof(scanword_t)); i != 0; ) {
     91        for (unsigned int i = (sizeof(BitBlock)/sizeof(ScanWord)); i != 0; ) {
    9292                if (u.elems[--i] != 0) return so_far | scan_backward_zeroes(u.elems[i]);
    93                 so_far += 8 * sizeof(scanword_t);
     93                so_far += 8 * sizeof(ScanWord);
    9494        }
    9595        return so_far;
     
    102102
    103103IDISA_ALWAYS_INLINE uint32_t bitstream_scan(BitBlock * v, uint32_t pos) {
    104         scanword_t * bitstream_ptr = (scanword_t *) (((intptr_t) v) + pos/8);
    105         scanword_t bitstream_slice = ((*bitstream_ptr) >> (pos % 8));
     104        ScanWord * bitstream_ptr = (ScanWord *) (((intptr_t) v) + pos/8);
     105        ScanWord bitstream_slice = ((*bitstream_ptr) >> (pos % 8));
    106106        if (bitstream_slice != 0) return pos + scan_forward_zeroes(bitstream_slice);
    107107        else {
  • trunk/lib/bitblock_iterator.hpp

    r2352 r2594  
    5454  - '->' - Not implemented.
    5555
    56         BitBlockForwardIterator - ForwardIterator derived specialization of ForwardIterator<BitBlock, scanword_t>
    57 
    58         BitBlockReverseIterator - ForwardIterator derived specialization of ReverseIterator<BitBlock, scanword_t>
     56        BitBlockForwardIterator - ForwardIterator derived specialization of ForwardIterator<BitBlock, Scanword>
     57
     58        BitBlockReverseIterator - ForwardIterator derived specialization of ReverseIterator<BitBlock, Scanword>
    5959
    6060        * BitStreamIterators
     
    136136        IDISA_ALWAYS_INLINE int32_t get_pos() const {return this->pos;}
    137137
    138         static const uint32_t BLOCK_COUNT = sizeof(bitblock_t)/sizeof(scanblock_t);
     138        static const int32_t BLOCK_COUNT = sizeof(bitblock_t)/sizeof(scanblock_t);
    139139
    140140};
     
    251251};
    252252
    253 class BitBlockForwardIterator: public ForwardIterator<BitBlock, scanword_t> {
     253class BitBlockForwardIterator: public ForwardIterator<BitBlock, ScanWord> {
    254254public:
    255255        BitBlockForwardIterator(){}
    256         BitBlockForwardIterator(BitBlock * s): ForwardIterator<BitBlock, scanword_t>(s){}
     256        BitBlockForwardIterator(BitBlock * s): ForwardIterator<BitBlock, ScanWord>(s){}
    257257};
    258258
     
    310310};
    311311
    312 class BitBlockReverseIterator: public ReverseIterator<BitBlock, scanword_t> {
     312class BitBlockReverseIterator: public ReverseIterator<BitBlock, ScanWord> {
    313313public:
    314314        BitBlockReverseIterator(){}
    315         BitBlockReverseIterator(BitBlock * s): ReverseIterator<BitBlock, scanword_t>(s){}
     315        BitBlockReverseIterator(BitBlock * s): ReverseIterator<BitBlock, ScanWord>(s){}
    316316};
    317317
     
    330330                                                                                         blk(0),
    331331                                                                                         blk_pos(0),
    332                                                                                          strm((scanword_t *)s),
    333                                                                                          scan_blk(*((scanword_t *)s)),
     332                                                                                         strm((ScanWord *)s),
     333                                                                                         scan_blk(*((ScanWord *)s)),
    334334                                                                                         scan_blk_cnt(cnt)
    335335        {
     
    401401        uint32_t blk;
    402402        int32_t blk_pos;
    403         const scanword_t * strm;
    404         scanword_t scan_blk;
     403        const ScanWord * strm;
     404        ScanWord scan_blk;
    405405        uint32_t scan_blk_cnt;
    406406
     
    414414                        }
    415415
    416                         blk_pos += (sizeof(scanword_t)*8);
     416                        blk_pos += (sizeof(ScanWord)*8);
    417417                        blk++;
    418418                        scan_blk = strm[blk];
  • trunk/lib/builtins.hpp

    r2275 r2594  
    99    Licensed to the public under the Open Software License 3.0.
    1010    Licensed to International Characters Inc.
    11        under the Academic Free License version 3.0.
     11       under the Academic Free License version 3.0. 
    1212=============================================================================*/
    1313
     
    4242
    4343        #ifdef _M_X64
    44         typedef unsigned __int64 scanword_t;
     44        typedef unsigned __int64 ScanWord;
    4545        #define ScanForwardIntrinsic _BitScanForward64
    4646        #define ScanReverseIntrinsic _BitScanReverse64
    4747        #else
    48         typedef unsigned __int32 scanword_t;
     48        typedef unsigned __int32 ScanWord;
    4949        #define ScanForwardIntrinsic _BitScanForward
    5050        #define ScanReverseIntrinsic _BitScanReverse
     
    5353        #pragma intrinsic(ScanForwardIntrinsic)
    5454        #pragma intrinsic(ScanReverseIntrinsic)
    55         IDISA_ALWAYS_INLINE uint32_t scan_forward_zeroes(scanword_t x) { // Precondition: x != 0
     55        IDISA_ALWAYS_INLINE uint32_t scan_forward_zeroes(ScanWord x) { // Precondition: x != 0
    5656                unsigned long zeroes;
    5757                ScanForwardIntrinsic(&zeroes, x);
     
    5959        }
    6060
    61         IDISA_ALWAYS_INLINE uint32_t scan_backward_zeroes(scanword_t x) { // Precondition: x != 0
     61        IDISA_ALWAYS_INLINE uint32_t scan_backward_zeroes(ScanWord x) { // Precondition: x != 0
    6262                unsigned long pos;
    6363                ScanReverseIntrinsic(&pos, x);
    64                 return (uint32_t) (8* sizeof(scanword_t) - pos - 1);
     64                return (uint32_t) (8* sizeof(ScanWord) - pos - 1);
    6565        }
    6666
     
    7171
    7272        #if __x86_64__ /* 64-bit architecture */
    73         typedef uint64_t scanword_t;
     73        typedef uint64_t ScanWord;
    7474        #define ScanForwardIntrinsic __builtin_ctzll
    7575        #define ScanReverseIntrinsic __builtin_clzll
    7676
    7777        #else
    78         typedef uint32_t scanword_t;
     78        typedef uint32_t ScanWord;
    7979        #define ScanForwardIntrinsic __builtin_ctzl
    8080        #define ScanReverseIntrinsic __builtin_clzl
    8181        #endif
    8282
    83         IDISA_ALWAYS_INLINE uint32_t scan_forward_zeroes(scanword_t x) { // Precondition: x != 0
    84                 return (uint32_t) ScanForwardIntrinsic((scanword_t) x);
     83        IDISA_ALWAYS_INLINE uint32_t scan_forward_zeroes(ScanWord x) { // Precondition: x != 0
     84                return (uint32_t) ScanForwardIntrinsic((ScanWord) x);
    8585        }
    8686
    87         IDISA_ALWAYS_INLINE uint32_t scan_backward_zeroes(scanword_t x) { // Precondition: x != 0
    88                 return (uint32_t) ScanReverseIntrinsic((scanword_t) x);
     87        IDISA_ALWAYS_INLINE uint32_t scan_backward_zeroes(ScanWord x) { // Precondition: x != 0
     88                return (uint32_t) ScanReverseIntrinsic((ScanWord) x);
    8989        }
    9090
Note: See TracChangeset for help on using the changeset viewer.