47 operator const char*()
const;
52 void set(
size_t size );
53 void set(
const char * str );
69 int rand(
long & seed );
78 std::cout <<
"zchz->errno[ ";
86 default: std::cout <<
"Unknow error";
break;
94 for (
size_t i=0; i<
SIZE; ++i ) {
95 char next =
rand(seed) % UCHAR_MAX;
96 if ( before[i] != next ) {
101 if ( after[i] != next ) {
114 for (
size_t i=0; i<
SIZE; ++i ) {
115 char next =
rand(seed) % UCHAR_MAX;
130 if ( 0<size && size<=
SIZE ) {
147 set( 1+strlen(str) );
193 inline zchz::operator
char*() {
195 return (m_block+SIZE) + m_idx;
199 inline zchz::operator
const char*()
const {
200 (
const_cast<zchz*
>(
this) ) -> check();
201 return (m_block+SIZE) + m_idx;
214 else if( diff > ptrdiff_t(r.
m_size) ) {
229 else if( diff > ptrdiff_t(l.
m_size) ) {
245 else if( diff > ptrdiff_t(l.
m_size) ) {
253 inline int rand(
long & seed ) {
254 #if ( INT_MAX <= 32767 )
256 seed = 22,695,477 * seed + 1;
257 return ((
int)(seed >> 16) & 0x7fff);
260 const int m = 2147483647;
268 test = a * lo - r * hi;
269 seed = ( test>0 ? test : test+m );
friend char * operator+(zchz &l, int i)
void check()
Checks whether the memory around the string value holds the value stored method set().
friend ptrdiff_t operator-(char *l, zchz &r)
Size of the allocated block for any 'zchz'.
int rand(long &seed)
Used 'seed' to generate the next random number.
ptrdiff_t operator-(char *l, zchz &r)
size_t m_idx
Current offset for pointer access.
char m_block[3 *real_SIZE]
Stored string value.
size_t strsz() const
Get current block size.
Contains a memory block of 'SIZE' characters in between 3 memory blocks of that same 'zchz::SIZE'...
char & operator[](size_t i)
ZCHZ += i.
size_t m_size
Current size of stored value.
zchz(size_t n)
Constructor.
Abreviation for real_SIZE.
zchz(const char *str)
Constructor.
zchz & operator+=(size_t n)
ZCHZ[i].
void reset_filling()
Initializes the block that surroung the stored value.
Max block size (change it if you need more)
char * operator+(zchz &l, int i)
void set(size_t size)
Set the internal will have size equal to 'size'.