Binary digits: Difference between revisions
Content added Content deleted
Line 1,561: | Line 1,561: | ||
{ |
{ |
||
// This algorithm is not the fastest one, but is relativelly simple. |
// This algorithm is not the fastest one, but is relativelly simple. |
||
// |
|||
// A faster algorithm would be conversion octets to strings by a lookup table. |
// A faster algorithm would be conversion octets to strings by a lookup table. |
||
// There is only 2**8 == 256 octets, therefore we would need only 512 bytes |
|||
// for the lookup table. Conversion of a 64-bit integers would need 8 lookups |
|||
// instead 64 and/or/shifts of bits etc. Even more... lookups may be implemented |
|||
// with XLAT or similar CPU instruction... and AVX/SSE gives chance for SIMD. |
|||
const unsigned N_DIGITS = sizeof(unsigned) * 8; |
const unsigned N_DIGITS = sizeof(unsigned) * 8; |