oclyke / crc Goto Github PK
View Code? Open in Web Editor NEWpythonic tutorial working step-by-step through Ross N. Williams' crc_v3.txt
pythonic tutorial working step-by-step through Ross N. Williams' crc_v3.txt
In the long division example:
print()
print('Division is a little messier as we need to know when "a number goes into another number"')
pN = polynomial(b'\x35\xb0', bits=14)
pD = polynomial(b'\x13\xb0', bits=5)
pW = pN
pW_virtual_bits = pW.bits
print('-- in this example the quotient is not calculated --')
print(' ---------------')
print(str(pD)+' ) '+str(pW))
for i in range(pN.bits-pD.bits,-1,-1):
s = ' '*(8+(pN.bits-pD.bits-i))
if(pW/(pD<<i)):
print(s+str(pD<<i))
pW -= (pD<<i)
else:
print(s+str(p0*(pD<<i)))
print(s+'-----')
pW_virtual_bits-=1
print(' '+s+pW.to_str(pW_virtual_bits))
print('The remainder is the CRC checksum')
A 'virtual' bit counter has been added to the 'working' polynomial pW
. Before this the pW.bit
attribute was being manipulated directly (where the virtual bit counter is manipulated now). This caused odd behavior with the .get_highest_bit_index()
method where it would report that the data in the polynomial was all zeros.
In the future the .bits
attribute should be 'safe' to modify at any time and only represent how many bits wide the representation should be
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.