source: proto/parabix2/byteutil.py @ 340

Last change on this file since 340 was 340, checked in by ksherdy, 10 years ago

Initial check in.

  • Property svn:executable set to *
File size: 789 bytes
Line 
1#
2# byteutil.py
3#
4# Bytestream Utilities
5#
6# These are quick-and-dirty Python implementations of utilities
7# for demo purposes only.
8#
9# Ken S. Herdy
10# September 2, 2009
11#
12#----------------------------------------------------------------------------
13#
14# We use python's unlimited precision integers for unbounded bit streams.
15# This permits simple logical operations on the entire stream.
16# Assumption: bitstreams are little-endian (e.g., as on x86).
17#
18#----------------------------------------------------------------------------
19#
20
21# Utility functions for demo purposes.
22#
23def print_arrays(array_list):
24        """Print out a set of aligned arrays."""
25        label_max = max([len(p[0]) for p in array_list])
26        for p in array_list:
27                print (p[0] + " "*(label_max - len(p[0]))) + ": " + str(p[1])
28                               
Note: See TracBrowser for help on using the repository browser.