📄 vlongvalue.h
字号:
class flex_unit // Provides storage allocation and index checking
{
unsigned *a; // array of units
unsigned z; // units allocated
public:
unsigned n; // used units (read-only)
flex_unit();
~flex_unit();
void clear(); // set n to zero
unsigned get( unsigned i ) const; // get ith unsigned
void set( unsigned i, unsigned x ); // set ith unsigned
void reserve( unsigned x ); // storage hint
// Time critical routine
void fast_mul( flex_unit &x, flex_unit &y, unsigned n );
};
class vlong_value : public flex_unit
{
public:
unsigned share; // share count, used by vlong to delay physical copying
int is_zero() const;
int test( unsigned i ) const;
unsigned bits() const;
int cf( vlong_value& x ) const;
void shl();
void shr();
void shr( unsigned n );
void add( vlong_value& x );
void subtract( vlong_value& x );
void init( unsigned x );
void copy( vlong_value& x );
operator unsigned(); // Unsafe conversion to unsigned
vlong_value();
void mul( vlong_value& x, vlong_value& y );
void divide( vlong_value& x, vlong_value& y, vlong_value& rem );
};
// Macros for doing double precision multiply
#define BPU ( 8*sizeof(unsigned) ) // Number of bits in an unsigned
#define lo(x) ( (x) & ((1<<(BPU/2))-1) ) // lower half of unsigned
#define hi(x) ( (x) >> (BPU/2) ) // upper half
#define lh(x) ( (x) << (BPU/2) ) // make upper half
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -