Ignore:
Timestamp:
Aug 26, 2016, 12:01:37 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
4999940
Parents:
486341f
Message:

refactored vector trait to speed-up compilation

Location:
src/libcfa/containers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/containers/vector

    r486341f r60aa49a7  
    1 // 
     1//
    22// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
    33//
    44// The contents of this file are covered under the licence agreement in the
    55// file "LICENCE" distributed with Cforall.
    6 // 
    7 // vector -- 
    8 // 
     6//
     7// vector --
     8//
    99// Author           : Thierry Delisle
    1010// Created On       : Tue Jul  5 18:00:07 2016
     
    1212// Last Modified On : Tue Jul  5 18:01:35 2016
    1313// Update Count     : 2
    14 // 
     14//
    1515
    1616#pragma once
     
    2828        void ctor(allocator_t* const);
    2929        void dtor(allocator_t* const);
    30         void realloc(allocator_t* const, size_t);
     30        void realloc_storage(allocator_t* const, size_t);
    3131        T* data(allocator_t* const);
    3232};
     
    6464static inline void reserve(vector(T, allocator_t) *const this, size_t size)
    6565{
    66         realloc(&this->storage, this->size+1);
     66        realloc_storage(&this->storage, this->size+1);
    6767}
    6868
     
    146146
    147147forall(otype T)
    148 void realloc(heap_allocator(T) *const this, size_t size);
     148void realloc_storage(heap_allocator(T) *const this, size_t size);
    149149
    150150forall(otype T)
  • src/libcfa/containers/vector.c

    r486341f r60aa49a7  
    1 // 
     1//
    22// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
    33//
    44// The contents of this file are covered under the licence agreement in the
    55// file "LICENCE" distributed with Cforall.
    6 // 
    7 // vector.c -- 
    8 // 
     6//
     7// vector.c --
     8//
    99// Author           : Thierry Delisle
    1010// Created On       : Tue Jul  5 18:07:52 2016
     
    1212// Last Modified On : Tue Jul  5 18:08:31 2016
    1313// Update Count     : 2
    14 // 
     14//
    1515
    16 #include <containers/vector> 
     16#include <containers/vector>
    1717
    1818#include <stdlib>
     
    3939void push_back(vector(T, allocator_t) *const this, T value)
    4040{
    41         realloc(&this->storage, this->size+1);
     41        realloc_storage(&this->storage, this->size+1);
    4242        data(&this->storage)[this->size] = value;
    4343        this->size++;
     
    7777
    7878forall(otype T)
    79 inline void realloc(heap_allocator(T) *const this, size_t size)
     79inline void realloc_storage(heap_allocator(T) *const this, size_t size)
    8080{
    8181        enum { GROWTH_RATE = 2 };
Note: See TracChangeset for help on using the changeset viewer.