Ignore:
Timestamp:
Apr 11, 2018, 7:31:18 AM (10 months ago)
Author:
cameron
Message:

Fixes for internal buffer search

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/grep/grep_engine.h

    r5954 r5963  
     1
    12/*
    23 *  Copyright (c) 2017 International Characters.
     
    1314#include <sstream>
    1415#include <atomic>
     16#include <util/aligned_allocator.h>
    1517
    1618namespace re { class CC; }
     
    182184#define INITIAL_CAPACITY 1024
    183185   
    184     class SearchableBuffer  {
    185         SearchableBuffer();
    186         void addSearchCandidate(char * string_ptr, size_t length);
    187         size_t getCandidateCount() {return mEntries;}
    188         char * getBufferBase() {return mBuffer_base;}
    189         size_t getBufferSize() {return mSpace_used;}
    190         ~SearchableBuffer();
    191     private:
    192         static const unsigned BUFFER_ALIGNMENT = MAX_SIMD_WIDTH_SUPPORTED/8;
    193         size_t mAllocated_capacity;
    194         char * mBuffer_base;
    195         alignas(BUFFER_ALIGNMENT) char mInitial_buffer[INITIAL_CAPACITY];
    196         size_t mSpace_used;
    197         size_t mEntries;
    198     };
     186class SearchableBuffer  {
     187public:
     188    SearchableBuffer();
     189    void addSearchCandidate(const char * string_ptr);
     190    size_t getCandidateCount() {return mEntries;}
     191    char * getBufferBase() {return mBuffer_base;}
     192    size_t getBufferSize() {return mSpace_used;}
     193    ~SearchableBuffer();
     194private:
     195    static const unsigned BUFFER_ALIGNMENT = MAX_SIMD_WIDTH_SUPPORTED/8;
     196    AlignedAllocator<char, BUFFER_ALIGNMENT> mAllocator;
     197    size_t mAllocated_capacity;
     198    size_t mSpace_used;
     199    size_t mEntries;
     200    char * mBuffer_base;
     201    alignas(BUFFER_ALIGNMENT) char mInitial_buffer[INITIAL_CAPACITY];
     202};
    199203
    200204}
Note: See TracChangeset for help on using the changeset viewer.