--- /dev/null
+#ifndef _BLOCK_ARRAY_H_
+#define _BLOCK_ARRAY_H_
+#include <iostream>
+#include "Tools.h"
+
+class BlockArray
+{
+private:
+ ulong* data;
+ ulong n;
+ ulong index;
+ ulong blockLength;
+public:
+ BlockArray(ulong len, ulong blockLen) {
+ n = len;
+ blockLength = blockLen;
+ data = new ulong[n*blockLength/W +1];
+ }
+ ~BlockArray() {
+ delete [] data;
+ }
+
+ BlockArray& operator[](ulong i) {
+ index = i;
+ return *this;
+ }
+
+ void operator=(const ulong x) {
+ Tools::SetField(data,blockLength,index,x);
+ }
+
+ BlockArray& operator=(const BlockArray& ba) {
+ if (this == &ba) return *this;
+ ulong value = Tools::GetField(ba.data, ba.blockLength, ba.index);
+ Tools::SetField(data,blockLength,index,value);
+ return *this;
+ }
+
+ operator ulong() {
+ return Tools::GetField(data,blockLength,index);
+ }
+
+ ulong spaceInBits() {
+ return n*blockLength+W; // plus 4 ulong's
+ }
+
+};
+
+#endif
+