Ignore:
Timestamp:
Aug 2, 2013, 2:14:03 PM (6 years ago)
Author:
ksherdy
Message:

Added popcount.

File:
1 edited

Legend:

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

    r3423 r3424  
    170170        return ~Advance(~0)
    171171
    172 def popcount(strm)
     172def popcount(stream):
    173173        count = 0
    174         while(strm > 0):
    175                 count = count + (strm & 1)
    176                 strm <<= strm
     174        while(stream > 0):
     175                if stream & 1 == 1: count += 1
     176                stream >>= 1
    177177        return count
    178178
Note: See TracChangeset for help on using the changeset viewer.