3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-06 14:13:23 +00:00

formatting (tabs)

Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
Christoph M. Wintersteiger 2015-02-07 18:05:52 +00:00
parent 359c7e4da9
commit 778dd997d3

View file

@ -31,18 +31,18 @@ protected:
char m_initial_buffer[INITIAL_SIZE * sizeof(T)]; char m_initial_buffer[INITIAL_SIZE * sizeof(T)];
void free_memory() { void free_memory() {
if (m_buffer != reinterpret_cast<T*>(m_initial_buffer)) { if (m_buffer != reinterpret_cast<T*>(m_initial_buffer)) {
memory::deallocate(m_buffer); memory::deallocate(m_buffer);
} }
} }
void expand() { void expand() {
unsigned new_capacity = m_capacity << 1; unsigned new_capacity = m_capacity << 1;
T * new_buffer = reinterpret_cast<T*>(memory::allocate(sizeof(T) * new_capacity)); T * new_buffer = reinterpret_cast<T*>(memory::allocate(sizeof(T) * new_capacity));
memcpy(new_buffer, m_buffer, m_pos * sizeof(T)); memcpy(new_buffer, m_buffer, m_pos * sizeof(T));
free_memory(); free_memory();
m_buffer = new_buffer; m_buffer = new_buffer;
m_capacity = new_capacity; m_capacity = new_capacity;
} }
void destroy_elements() { void destroy_elements() {
@ -50,14 +50,14 @@ protected:
iterator e = end(); iterator e = end();
for (; it != e; ++it) { for (; it != e; ++it) {
it->~T(); it->~T();
} }
} }
void destroy() { void destroy() {
if (CallDestructors) { if (CallDestructors) {
destroy_elements(); destroy_elements();
} }
free_memory(); free_memory();
} }
public: public:
@ -66,15 +66,15 @@ public:
typedef const T * const_iterator; typedef const T * const_iterator;
buffer(): buffer():
m_buffer(reinterpret_cast<T *>(m_initial_buffer)), m_buffer(reinterpret_cast<T *>(m_initial_buffer)),
m_pos(0), m_pos(0),
m_capacity(INITIAL_SIZE) { m_capacity(INITIAL_SIZE) {
} }
buffer(const buffer & source): buffer(const buffer & source):
m_buffer(reinterpret_cast<T *>(m_initial_buffer)), m_buffer(reinterpret_cast<T *>(m_initial_buffer)),
m_pos(0), m_pos(0),
m_capacity(INITIAL_SIZE) { m_capacity(INITIAL_SIZE) {
unsigned sz = source.size(); unsigned sz = source.size();
for(unsigned i = 0; i < sz; i++) { for(unsigned i = 0; i < sz; i++) {
push_back(source.m_buffer[i]); push_back(source.m_buffer[i]);
@ -82,9 +82,9 @@ public:
} }
buffer(unsigned sz, const T & elem): buffer(unsigned sz, const T & elem):
m_buffer(reinterpret_cast<T *>(m_initial_buffer)), m_buffer(reinterpret_cast<T *>(m_initial_buffer)),
m_pos(0), m_pos(0),
m_capacity(INITIAL_SIZE) { m_capacity(INITIAL_SIZE) {
for (unsigned i = 0; i < sz; i++) { for (unsigned i = 0; i < sz; i++) {
push_back(elem); push_back(elem);
} }
@ -96,10 +96,10 @@ public:
} }
void reset() { void reset() {
if (CallDestructors) { if (CallDestructors) {
destroy_elements(); destroy_elements();
} }
m_pos = 0; m_pos = 0;
} }
void finalize() { void finalize() {
@ -110,11 +110,11 @@ public:
} }
unsigned size() const { unsigned size() const {
return m_pos; return m_pos;
} }
bool empty() const { bool empty() const {
return m_pos == 0; return m_pos == 0;
} }
iterator begin() { iterator begin() {
@ -126,13 +126,13 @@ public:
} }
void set_end(iterator it) { void set_end(iterator it) {
m_pos = static_cast<unsigned>(it - m_buffer); m_pos = static_cast<unsigned>(it - m_buffer);
if (CallDestructors) { if (CallDestructors) {
iterator e = end(); iterator e = end();
for (; it != e; ++it) { for (; it != e; ++it) {
it->~T(); it->~T();
} }
} }
} }
const_iterator begin() const { const_iterator begin() const {
@ -144,33 +144,33 @@ public:
} }
void push_back(const T & elem) { void push_back(const T & elem) {
if (m_pos >= m_capacity) if (m_pos >= m_capacity)
expand(); expand();
new (m_buffer + m_pos) T(elem); new (m_buffer + m_pos) T(elem);
m_pos++; m_pos++;
} }
void pop_back() { void pop_back() {
if (CallDestructors) { if (CallDestructors) {
back().~T(); back().~T();
} }
m_pos--; m_pos--;
} }
const T & back() const { const T & back() const {
SASSERT(!empty()); SASSERT(!empty());
SASSERT(m_pos > 0); SASSERT(m_pos > 0);
return m_buffer[m_pos - 1]; return m_buffer[m_pos - 1];
} }
T & back() { T & back() {
SASSERT(!empty()); SASSERT(!empty());
SASSERT(m_pos > 0); SASSERT(m_pos > 0);
return m_buffer[m_pos - 1]; return m_buffer[m_pos - 1];
} }
T * c_ptr() const { T * c_ptr() const {
return m_buffer; return m_buffer;
} }
void append(unsigned n, T const * elems) { void append(unsigned n, T const * elems) {