Set the read buffer size in the cmake file.
This commit is contained in:
parent
1a644a543b
commit
9b437e52d3
3 changed files with 15 additions and 1 deletions
|
@ -8,5 +8,15 @@ set(CMAKE_D_FLAGS_DEBUG "${CMAKE_D_FLAGS_DEBUG} -funittest -g -O0 -Wall -Wdeprec
|
||||||
set(CMAKE_D_FLAGS_RELEASE "${CMAKE_D_FLAGS_RELEASE} -O3 -Wall -Wdeprecated")
|
set(CMAKE_D_FLAGS_RELEASE "${CMAKE_D_FLAGS_RELEASE} -O3 -Wall -Wdeprecated")
|
||||||
|
|
||||||
option(REFERENCE_TIGER "Use the reference implementation of the tiger algorithm." OFF)
|
option(REFERENCE_TIGER "Use the reference implementation of the tiger algorithm." OFF)
|
||||||
|
set(READ_BUFF_SIZE "1024 * 16")
|
||||||
|
|
||||||
|
#Just here to nicely print how big the read buffer will be, it doesn't really
|
||||||
|
#do anything important.
|
||||||
|
math(EXPR READ_BUFF_SIZE_RESULT "(${READ_BUFF_SIZE} / 64) * 64")
|
||||||
|
if (${READ_BUFF_SIZE_RESULT} LESS 64)
|
||||||
|
set(READ_BUFF_SIZE_RESULT 64)
|
||||||
|
endif()
|
||||||
|
message(STATUS "Read buffer size will be ${READ_BUFF_SIZE_RESULT} bytes")
|
||||||
|
unset(READ_BUFF_SIZE_RESULT)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
|
@ -20,6 +20,8 @@ import std.string;
|
||||||
import std.array, std.range;
|
import std.array, std.range;
|
||||||
import std.algorithm;
|
import std.algorithm;
|
||||||
|
|
||||||
|
mixin(import("tigersumConfig.d"));
|
||||||
|
|
||||||
private extern(C) void tiger (char* parMessage, ulong parLength, out ulong[3] parOut, char parPadding);
|
private extern(C) void tiger (char* parMessage, ulong parLength, out ulong[3] parOut, char parPadding);
|
||||||
private extern(C) void tiger_init (out ulong[3] parOut);
|
private extern(C) void tiger_init (out ulong[3] parOut);
|
||||||
private extern(C) void tiger_chunk (char* parMessage, ulong parLength, out ulong[3] parOut);
|
private extern(C) void tiger_chunk (char* parMessage, ulong parLength, out ulong[3] parOut);
|
||||||
|
@ -48,7 +50,7 @@ public ulong[3] getTiger (in string parData, bool parV2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ulong[3] getTiger (ref File parData, bool parV2) {
|
public ulong[3] getTiger (ref File parData, bool parV2) {
|
||||||
const auto buff_length = 64 * 128;
|
const auto buff_length = 64 * READ_BUFF_BLOCKS;
|
||||||
char[] unaligned = new char[buff_length + ulong.alignof - 1];
|
char[] unaligned = new char[buff_length + ulong.alignof - 1];
|
||||||
size_t offset = ((cast(size_t)unaligned.ptr + (ulong.alignof - 1)) & ~cast(size_t)(ulong.alignof - 1)) - cast(size_t)unaligned.ptr;
|
size_t offset = ((cast(size_t)unaligned.ptr + (ulong.alignof - 1)) & ~cast(size_t)(ulong.alignof - 1)) - cast(size_t)unaligned.ptr;
|
||||||
assert(offset >= 0 && offset < ulong.alignof);
|
assert(offset >= 0 && offset < ulong.alignof);
|
||||||
|
|
|
@ -6,3 +6,5 @@ const string PROGRAM_NAME = "@PROJECT_NAME@";
|
||||||
const string BACKEND_WEBSITE = "@BACKEND_WEBSITE@";
|
const string BACKEND_WEBSITE = "@BACKEND_WEBSITE@";
|
||||||
const string BACKEND_NAME = "@BACKEND_NAME@";
|
const string BACKEND_NAME = "@BACKEND_NAME@";
|
||||||
const string BACKEND_AUTHOR = "@BACKEND_AUTHOR@";
|
const string BACKEND_AUTHOR = "@BACKEND_AUTHOR@";
|
||||||
|
|
||||||
|
const int READ_BUFF_BLOCKS = ((@READ_BUFF_SIZE@) / 64 < 1 ? 1 : (@READ_BUFF_SIZE@) / 64);
|
||||||
|
|
Loading…
Reference in a new issue