Bladeren bron

improved buffers

devel
Ludovic 'Archivist' Lagouardette 4 jaren geleden
bovenliggende
commit
f92e3b43cb
2 gewijzigde bestanden met toevoegingen van 25 en 1 verwijderingen
  1. +1
    -1
      Makefile
  2. +24
    -0
      include/gp/buffer.hpp

+ 1
- 1
Makefile Bestand weergeven

@ -1,5 +1,5 @@
CXX= clang++-8
CXXFLAGS= --std=c++17 -O3 -pthread -DGP_TESTS -DFUZZ_STRENGTH=500 -pedantic -Werror \
CXXFLAGS= --std=c++17 -O0 -pthread -DGP_TESTS -DFUZZ_STRENGTH=500 -pedantic -Werror \
-Wno-unknown-attributes \
-g -fprofile-instr-generate -fcoverage-mapping
# -fsanitize=address -fno-omit-frame-pointer

+ 24
- 0
include/gp/buffer.hpp Bestand weergeven

@ -119,5 +119,29 @@ namespace gp{
return buffer{(T*)nullptr,(size_t)0};
}
}
buffer trim_start(size_t rm_sz)
{
if(rm_sz<=size())
{
return buffer{begin().data + rm_sz, end().data};
}
else
{
return buffer{(T*)nullptr,(size_t)0};
}
}
buffer trim_end(size_t rm_sz)
{
if(rm_sz<=size())
{
return buffer{begin().data, end().data - rm_sz};
}
else
{
return buffer{(T*)nullptr,(size_t)0};
}
}
};
}

Laden…
Annuleren
Opslaan