Ignore:
Timestamp:
Jul 23, 2016, 1:04:44 PM (3 years ago)
Author:
cameron
Message:

Use dynamic size_t determination

File:
1 edited

Legend:

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

    r5102 r5106  
    8282bool isUTF_16 = false;
    8383
    84 void GrepEngine::doGrep(const std::string & fileName, const int fileIdx, bool CountOnly, std::vector<uint64_t> & total_CountOnly, bool UTF_16) {
     84void GrepEngine::doGrep(const std::string & fileName, const int fileIdx, bool CountOnly, std::vector<size_t> & total_CountOnly, bool UTF_16) {
    8585    boost::filesystem::path file(fileName);
    8686    if (exists(file)) {
     
    109109    } else {
    110110        if (CountOnly) {
    111             mGrepFunction_CountOnly(nullptr, 0, fileIdx);
     111            total_CountOnly[fileIdx] = mGrepFunction_CountOnly(nullptr, 0, fileIdx);
    112112        } else {
    113113            mGrepFunction(nullptr, 0, fileIdx);
     
    134134    mIsNameExpression = isNameExpression;
    135135
    136     Type * const int64ty = iBuilder->getInt64Ty();
     136    Type * const size_ty = iBuilder->getSizeTy();
    137137    Type * const int8PtrTy = iBuilder->getInt8PtrTy();
    138138    Type * const inputType = PointerType::get(ArrayType::get(ArrayType::get(iBuilder->getBitBlockType(), (UTF_16 ? 16 : 8)), 1), 0);
    139     Type * const resultTy = CountOnly ? int64ty : iBuilder->getVoidTy();
    140     Function * const mainFn = cast<Function>(M->getOrInsertFunction("Main", resultTy, inputType, int64ty, int64ty, nullptr));
     139    Type * const resultTy = CountOnly ? size_ty : iBuilder->getVoidTy();
     140    Function * const mainFn = cast<Function>(M->getOrInsertFunction("Main", resultTy, inputType, size_ty, size_ty, nullptr));
    141141    mainFn->setCallingConv(CallingConv::C);
    142142    iBuilder->SetInsertPoint(BasicBlock::Create(M->getContext(), "entry", mainFn, 0));
     
    177177    }
    178178    else {
    179         kernel::scanMatchKernel scanMatchK(iBuilder, MatchResults, 64, false);
     179        kernel::scanMatchKernel scanMatchK(iBuilder, MatchResults, false);
    180180        scanMatchK.generateKernel();
    181181               
     
    242242
    243243extern "C" {
    244     void wrapped_report_match(uint64_t lineNum, uint64_t line_start, uint64_t line_end, const char * buffer, uint64_t filesize, int fileIdx) {
     244    void wrapped_report_match(size_t lineNum, size_t line_start, size_t line_end, const char * buffer, size_t filesize, int fileIdx) {
    245245        int index = isUTF_16 ? 2 : 1;
    246246        int idx = fileIdx;
     
    302302}
    303303
    304 void PrintResult(bool CountOnly, std::vector<uint64_t> & total_CountOnly){
     304void PrintResult(bool CountOnly, std::vector<size_t> & total_CountOnly){
    305305    if(CountOnly){
    306306        if (!ShowFileNames) {
     
    325325
    326326extern "C" {
    327     void insert_codepoints(uint64_t lineNum, uint64_t line_start, uint64_t line_end, const char * buffer) {
     327    void insert_codepoints(size_t lineNum, size_t line_start, size_t line_end, const char * buffer) {
    328328        re::codepoint_t c = 0;
    329329        ssize_t line_pos = line_start;
Note: See TracChangeset for help on using the changeset viewer.