source: utilitiespy/tudelft/utilities/tools/calc.py@ 1206

Last change on this file since 1206 was 1206, checked in by wouter, 3 weeks ago

#379 added asbyte function to support int-byte conversion

File size: 165 bytes
Line 
1
2
3def asbyte(b:int):
4 '''
5 @param b an int to be truncated to signed byte.
6 @return b&255 as 2-complement signed number
7 '''
8 return ((b+128)&255)-128
Note: See TracBrowser for help on using the repository browser.