Old snapshot `BigIntegerLibrary-2005.01.17'; see the ChangeLog file.
[bigint/bigint.git] / NumberlikeArray.hh
index 79d46df..345cfd7 100644 (file)
@@ -20,8 +20,8 @@
 #endif
 
 /*
-* A NumberlikeArray<Block> object holds a dynamically
-* allocated array of Blocks.  It provides certain basic
+* A NumberlikeArray<Blk> object holds a dynamically
+* allocated array of Blk.  It provides certain basic
 * memory management features needed by both BigUnsigned
 * and BigUnsignedInABase, which are both derived from it.
 *
@@ -42,11 +42,13 @@ class NumberlikeArray {
        public:
        
        typedef unsigned int Index; // Type for the index of a block in the array
+       static const unsigned int N; // The number of bits in a block, defined below.
        
        // FIELDS
        Index cap; // The current allocated capacity of this NumberlikeArray (in blocks)
        Index len; // The actual length of the value stored in this NumberlikeArray (in blocks)
        Blk *blk; // Dynamically allocated array of the blocks
+       
        /*
        * Change made on 2005.01.06:
        *
@@ -112,6 +114,7 @@ class NumberlikeArray {
 };
 
 /*
+* =================================
 * BELOW THIS POINT are template definitions; above are declarations.
 *
 * Definitions would ordinarily belong in a file NumberlikeArray.cc so that they would
@@ -127,6 +130,9 @@ class NumberlikeArray {
 * so other files including NumberlikeArray will be able to generate real definitions.
 */
 
+template <class Blk>
+const unsigned int NumberlikeArray<Blk>::N = 8 * sizeof(Blk);
+
 // MANAGEMENT
 
 // This routine is called to ensure the array is at least a