New patch and wiki page for Integer

19 views
Skip to first unread message

Jeffrey Walton

unread,
Mar 30, 2015, 11:18:17 PM3/30/15
to cryptop...@googlegroups.com
The Integer Patch adds little-endian support and output base awareness to the Integer class. The endian support enables the Integer class to construct Integers from strings and byte arrays in little-endian format. Its useful for algorithms like Poly1305, where many parameters are provided in little-endian format.

The bases support allows Integers to honor the std::ios_base::showbase and std::ios_base::noshowbase flags. If std::noshowbase is in effect, then the Integer class will not emit the suffix. The suffixes are b, o, h, or . (the last is for decimal).

http://www.cryptopp.com/wiki/Integer_Patch

Jean-Pierre Münch

unread,
Mar 31, 2015, 9:24:32 AM3/31/15
to cryptop...@googlegroups.com
merged into CryptoJPM.
you might wanto to consider to adapt the change I made:
For is_decimal and is_hexdecimal, add a !=0 after the std::isdigit and std::isxdigit, to avoid compiler warnings because of integer -> bool conversion.

BR

JPM

Jeffrey Walton

unread,
Mar 31, 2015, 7:45:03 PM3/31/15
to cryptop...@googlegroups.com


On Tuesday, March 31, 2015 at 9:24:32 AM UTC-4, Jean-Pierre Münch wrote:
merged into CryptoJPM.
I updated the patch today. Using std::copy_if and std::reverse meant the array was touched twice. There are now custom routines that only touch the incoming array once. It also meant I could drop the changes to misc.h.

you might wanto to consider to adapt the change I made:
For is_decimal and is_hexdecimal, add a !=0 after the std::isdigit and std::isxdigit, to avoid compiler warnings because of integer -> bool conversion.
Ah, OK. GCC and Clang did not warn of it.

In the future, you get the best code with:

    !!std::isdigit(x)

And:

  !!std::isxdigit(x)

Microsoft compilers know to look for that pattern. I don't know if/how GCC/Clang handles it (other than producing expected code).
Reply all
Reply to author
Forward
0 new messages