12 // Is this still needed? (Lgb)
14 void * my_memcpy(void * ps_in, void const * pt_in, size_t n)
16 char * ps = static_cast<char *>(ps_in);
17 char const * pt = static_cast<char const *>(pt_in);
18 while (n--) *ps++ = *pt++;
23 int MathedArray::empty() const
29 int MathedArray::last() const
35 void MathedArray::last(int l)
41 int MathedArray::maxsize() const
43 return static_cast<int>(bf_.size());
47 void MathedArray::need_size(int needed)
49 if (needed >= maxsize())
54 void MathedArray::resize(int newsize)
56 if (newsize < ARRAY_MIN_SIZE)
57 newsize = ARRAY_MIN_SIZE;
58 newsize += ARRAY_STEP - (newsize % ARRAY_STEP);
60 if (last_ >= newsize) last_ = newsize - 1;
65 MathedArray::MathedArray(int size)
67 int newsize = (size < ARRAY_MIN_SIZE) ? ARRAY_MIN_SIZE : size;
73 void MathedArray::move(int p, int shift)
76 need_size(last_ + shift);
77 memmove(&bf_[p + shift], &bf_[p], last_ - p);
84 void MathedArray::mergeF(MathedArray * a, int p, int dx)
86 my_memcpy(&bf_[p], &a->bf_[0], dx);
90 void MathedArray::raw_pointer_copy(MathedInset ** p, int pos) const
92 my_memcpy(p, &bf_[pos], sizeof(MathedInset*));
96 void MathedArray::raw_pointer_insert(void * p, int pos, int len)
98 my_memcpy(&bf_[pos], &p, len);
102 void MathedArray::strange_copy(MathedArray * dest, int dpos,
105 my_memcpy(&dest->bf_[dpos], &bf_[spos], len);
109 byte MathedArray::operator[](int i) const
115 byte & MathedArray::operator[](int i)
121 void MathedArray::insert(int pos, byte c)
123 if (pos < 0) pos = last_;
125 // I think this should be replaced by need_size(pos). Note that the
126 // current code looks troublesome if pos > maxsize() + ARRAY_STEP.
127 if (pos >= maxsize())
128 resize(maxsize() + ARRAY_STEP);