source: proto/s2k/demo/lib/cast.py @ 3610

Last change on this file since 3610 was 3610, checked in by ksherdy, 5 years ago

Commit s2l library demo files.

File size: 357 bytes
Line 
1#
2# Ken Herdy
3# January 7, 2014
4#
5# cast.py
6#
7# s2k cast expressions.
8#
9# These are smoke-and-mirrors Python implementations of s2k operations
10# for demo purposes only.
11#
12
13import bitutil
14
15#
16# widening casts any zero-extend a partial final field
17#
18def bitcast(fw, bstr): # s2k syntax: bitcast<fw2>(s), 're-interprecast'
19  return bitutil.zfill(bstr,fw)
20
21
Note: See TracBrowser for help on using the repository browser.