Changeset 3423 for proto


Ignore:
Timestamp:
Aug 2, 2013, 1:59:04 PM (6 years ago)
Author:
ksherdy
Message:

Grep demo clean up / notes.

Location:
proto/RE/demo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • proto/RE/demo/grep_demo.py

    r3422 r3423  
    185185        ClassifyBytes(basis_bits, lex)
    186186        Match(lex, matches)
     187
     188        print str(pablo.popcount(matches))
     189
    187190        MatchLines1(lex, matches, lines)
    188191        FilterMatchLines(data, output)
  • proto/RE/demo/pablo.py

    r3422 r3423  
    169169def First():
    170170        return ~Advance(~0)
     171
     172def popcount(strm)
     173        count = 0
     174        while(strm > 0):
     175                count = count + (strm & 1)
     176                strm <<= strm
     177        return count
    171178
    172179def SpanUpTo(starts, ends):
     
    308315        return str
    309316
     317
Note: See TracChangeset for help on using the changeset viewer.