SHARE
TWEET

Untitled

a guest Sep 20th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Tritset::Reference Tritset::operator[](const int i) {
  2.  
  3.   if (i >= sizetrits) {
  4.     int tmp = (int) (ceil(i * 2 / (float) 8 / (float) sizeof(unsigned)));
  5.  
  6.     if (tmp <= sizearr) {
  7.       return Reference(memory, i);
  8.     } else {
  9.       unsigned *newMemory;
  10.       newMemory=new unsigned[tmp];
  11.       memset(newMemory, 0, tmp * sizeof(unsigned));
  12.       memcpy(newMemory, memory, sizearr * sizeof(unsigned));
  13.       sizearr = tmp;
  14.       sizetrits = i;
  15.       delete[] memory;
  16.       memory = newMemory;
  17.       return Reference(newMemory, i);
  18.     }
  19.   }
  20.  
  21.   return Reference(memory, i);
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top