I am using the NTL C++ Library. On trying to execute the following code:
NTL::ref_GF2 *zero = new NTL::ref_GF2();
NTL::ref_GF2 *one = new NTL::ref_GF2();
set(*one);
I am getting an EXC_BAD_INSTRUCTION error:
ref_GF2 operator=(long a)
{
unsigned long rval = a & 1;
unsigned long lval = *_ref_GF2__ptr;
lval = (lval & ~(1UL << _ref_GF2__pos)) | (rval << _ref_GF2__pos);
*_ref_GF2__ptr = lval;
return *this;
}
The problem seems to stem from the set(*one) line of code.
I've been trying to understand what's going wrong in the code, to no avail. Any help appreciated.