Changeset 1075 for trunk/lib/carryQ.h


Ignore:
Timestamp:
Apr 7, 2011, 7:02:22 PM (8 years ago)
Author:
cameron
Message:

scantofirst implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/carryQ.h

    r961 r1075  
    5959static inline BitBlock BitBlock_scanto(BitBlock markers0, BitBlock charclass, BitBlock EOF_mask) __attribute__ ((always_inline));
    6060
     61static inline BitBlock BitBlock_scantofirst(BitBlock charclass, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
     62
    6163static inline bool CarryTest(CarryQtype & cq, const int carryno, const int carry_count) __attribute__ ((always_inline));
    6264
     
    121123
    122124static inline BitBlock BitBlock_scanto(BitBlock markers0, BitBlock charclass, BitBlock EOF_mask) __attribute__ ((always_inline));
     125
     126static inline BitBlock BitBlock_scantofirst(BitBlock charclass, CarryQtype cq, const int carryno) __attribute__ ((always_inline));
    123127
    124128static inline bool CarryTest(CarryQtype cq, const int carryno, const int carry_count) __attribute__ ((always_inline));
     
    264268        return simd_andc(markers1, scanclass);
    265269}
     270
     271/* Scan to the first occurrence of an item in a charclass, set
     272   the carry once the first occurrence has been found, after
     273   which the returned BitBlock will always be zero.  */
     274
     275static inline BitBlock BitBlock_scantofirst(BitBlock charclass, CarryQtype cq, const int carryno) {
     276        BitBlock marker;
     277        CarryType c = carry_flip(cq[carryno]);
     278        adc128(simd_const_1(0), simd_not(charclass), c, marker);
     279        cq[carryno] = carry_flip(c);
     280        return simd_and(marker, charclass);
     281}
     282
    266283
    267284static inline bool CarryTest(CarryQtype cq, const int carryno, const int carry_count) {
     
    717734}
    718735
     736static inline BitBlock BitBlock_scantofirst(BitBlock charclass, CarryQtype & cq, const int carryno) {
     737printf("Not yet implemented: scantofirst\n");
     738}
     739
    719740
    720741#endif
Note: See TracChangeset for help on using the changeset viewer.