开发者

script for simple math fixing input/output size

Looking for an utility or script to do some simple math in hex, decimal or binary (+ - / x) but I want to define the format and size/signal/integer ... of output. For example 0xffff + 1 wi开发者_如何学Goll have different results if the output goes to an U16 or U32. maybe there is a tool in the web for that or somebody already did something related.


Perl has a bit-wise AND operator (&) (see Bitwise-And in perlop) which can be used to limit an integer to 16 bits. It also has sprintf and hex to perform conversions.


Well perl has a powerful math library Math::BigRat. see here: http://perldoc.perl.org/Math/BigRat.html

but for U16 or U32 i don't have any idea

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜