Looking for the latest version? Download pybitop-0.5.tar.gz (26.1 kB)
Name Modified Size Downloads / Week Status
pybitop 2012-10-14 0
README 2012-10-14 1.6 kB 0
Totals: 2 Items   1.6 kB
pybitop supplies bit-level operations on integers for Python. This module contains functions to perform bit level operations, e.g. bit extraction, reversal, counting; sign extension. Generally, inputs may be Python 'int' or 'long' types interchangably; return values are 'int' objects where possible and long' when the result does not fit in an int. functions: bit(ival,n) = bit at posn n; n >= 0 bitwidth(ival) = #bits required to hold ival (ival >= 0) this is ceil(log2(ival+1)) bitwidth_signed(ival) = # signed bits required to hold ival lowest_one(ival) = index of lowest '1' bit (-1 if ival is 0) bit_extract(ival,lo,hi) extract range of bits from ival bit_insert(ival1,lo,hi,ival2) field_mask( lo, hi) == sum(2**i for i in range(lo,hi)) sign_extend(ival,n) - discard bits n up; extend bit n-1 upwards. n>=1. bit_reverse(ival,n) - discard bits n up; bit-reverse the bits below n popcount(ival,n=None) - count all 1's in lower n bits (all bits if n missing; ival must be >=0 in this case). int_from_bytes( string [, byteorder]) convert bytes to a single integer; 'byteorder' is '<' for little-endian, '>' for big-endian, '' for native (default). int_to_bytes( k, nbytes [, byteorder]) convert a single integer to bytes; 'byteorder' is '<' for little-endian, '>' for big-endian, '' for native (default). Requires at least python 2.2; this release works up to Python 2.7, but does not support 3.x
Source: README, updated 2012-10-14

Thanks for helping keep SourceForge clean.

Screenshot instructions:
Red Hat Linux   Ubuntu

Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Briefly describe the problem (required):

Upload screenshot of ad (required):
Select a file, or drag & drop file here.

Please provide the ad click URL, if possible:

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks