Ignore:
Timestamp:
Jan 19, 2019, 2:44:53 PM (6 months ago)
Author:
cameron
Message:

Repeat of prior check in

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/editd/editd.cpp

    r6261 r6288  
    163163#warning make a "CBuffer" class to abstract away the complexity of making these function typedefs.
    164164
    165 typedef void (*preprocessFunctionType)(char * output_data, size_t & output_produced, size_t output_size, const uint32_t fd);
     165typedef void (*preprocessFunctionType)(char * output_data, size_t * output_produced, size_t output_size, const uint32_t fd);
    166166
    167167static char * chStream;
     
    218218}
    219219
    220 #define ALIGNMENT (32UL)
    221 
    222 inline bool is_power_2(const unsigned n) {
     220#define ALIGNMENT (512 / 8)
     221
     222inline bool is_power_2(const size_t n) {
    223223    return ((n & (n - 1)) == 0) && n;
    224224}
    225225
    226 inline unsigned round_up_to(const unsigned x, const unsigned y) {
     226inline size_t round_up_to(const size_t x, const size_t y) {
    227227    assert(is_power_2(y));
    228228    return (x + y - 1) & -y;
     
    231231char * preprocess(preprocessFunctionType preprocess) {
    232232    std::string fileName = inputFiles[0];
    233     const int fd = open(inputFiles[0].c_str(), O_RDONLY);
     233    const auto fd = open(inputFiles[0].c_str(), O_RDONLY);
    234234    if (LLVM_UNLIKELY(fd == -1)) {
    235235        std::cerr << "Error: cannot open " << fileName << " for processing.\n";
     
    240240    // Given a 8-bit bytestream of length n, we need space for 4 bitstreams of length n ...
    241241    AlignedAllocator<char, ALIGNMENT> alloc;
    242     const auto n = round_up_to(size, 8 * ALIGNMENT);
     242    const size_t n = round_up_to(size, 8 * ALIGNMENT);
    243243    chStream = alloc.allocate((4 * n) / 8);
    244     size_t length;
    245     preprocess(chStream, length, n, fd);
     244    size_t length = 0;
     245    preprocess(chStream, &length, n, fd);
    246246    close(fd);
    247247    return chStream;
Note: See TracChangeset for help on using the changeset viewer.