|
Boost : |
From: Scott Schurr (scott_schurr_at_[hidden])
Date: 2005-07-12 17:31:59
Greetings,
Prompted by some discussion on comp.sdt.c++.moderated, I have a
small template that allows the user to declare an integer literal
in binary.
Usage looks like:
#include "binary_int.hpp"
unsigned int binary = binary_int<1001,0011,1011,0000>::b;
The template is written to support up to 64 bits, although my
compiler only allows me test up to 32 bits. I intend to use it
for programming hardware registers in the language of the hardware
folk at my company.
The template is only about 150 lines and doesn't really deserve a
library, but it could potentially be tucked into another library
if it is deemed useful.
Thanks.
Scott Schurr
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk