Skip to content

Commit eec1db7

Browse files
committed
let all entries only support single LF
instead of former CR+LF
1 parent 99b0d3a commit eec1db7

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

entries/abouchez/src/brcmormot.lpr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ procedure ParseLine(var chunk: TBrcChunk); nostackframe; assembler;
111111
setne dl
112112
mov eax, dword ptr [r8 + 1] // eax = xx.x or x.x
113113
shl cl, 3
114-
lea r8, [r8 + rdx + 6] // r8 = next line
114+
lea r8, [r8 + rdx + 5] // r8 = next line (LF only)
115115
shl eax, cl // normalized as xx.x
116116
and eax, $0f000f0f // from ascii to digit
117117
imul rax, rax, 1 + 10 shl 16 + 100 shl 24
@@ -156,14 +156,14 @@ function CompareMem(a, b: PAnsiChar; l: PtrInt): boolean; nostackframe; assemble
156156
cmp rax, rdx
157157
jl @by1
158158
align 8
159-
@by8: mov rcx, qword ptr [rdi + rdx] // branchless for l>=8
159+
@by8: mov rcx, qword ptr [rdi + rdx] // branchless for 8..16 bytes
160160
cmp rcx, qword ptr [rsi + rdx]
161161
jne @set
162162
sub rdx, rax
163163
jz @ok
164164
cmp rax, rdx
165-
jge @by8
166-
mov rcx, qword ptr [rdi + rax] // may overlap
165+
jg @by8
166+
mov rcx, qword ptr [rdi + rax] // compare last 8 bytes - may overlap
167167
cmp rcx, qword ptr [rsi + rax]
168168
@set: sete al
169169
ret
@@ -194,7 +194,7 @@ procedure ParseLine(var chunk: TBrcChunk); inline;
194194
// branchless parsing of the temperature
195195
neg := ord(p[1] <> '-') * 2 - 1; // neg = +1 or -1
196196
inc(p, ord(p[1] = '-')); // ignore '-' sign
197-
chunk.Start := @p[ord(p[2] <> '.') + 6]; // next line
197+
chunk.Start := @p[ord(p[2] <> '.') + 5]; // next line (LF only)
198198
chunk.Value := PtrInt(cardinal((QWord((PCardinal(p + 1)^ shl
199199
(byte(ord(p[2] = '.') shl 3))) and $0f000f0f) *
200200
(1 + 10 shl 16 + 100 shl 24)) shr 24) and cardinal(1023)) * neg;
@@ -216,7 +216,7 @@ function CompareMem(a, b: PAnsiChar; l: PtrInt): boolean;
216216
dec(l, ptrsiz);
217217
if l = 0 then
218218
exit
219-
else if l <= ptrsiz then
219+
else if l < ptrsiz then
220220
continue;
221221
result := PPtrUInt(@a[ptrsiz])^ = PPtrUInt(@b[ptrsiz])^; // may overlap
222222
exit;
@@ -246,7 +246,7 @@ constructor TBrcThread.Create(owner: TBrcMain);
246246
FreeOnTerminate := true;
247247
SetLength(fStation, fOwner.fMax);
248248
InterlockedIncrement(fOwner.fRunning);
249-
inherited Create({suspended=}false);
249+
inherited Create({suspended=}false, {stacksize=}16384);
250250
end;
251251

252252

@@ -274,7 +274,7 @@ constructor TBrcMain.Create(const fn: TFileName; threads, chunkmb, max: integer;
274274
if not fullsearch then
275275
SetLength(fNameHash, fMax);
276276
SetLength(fNameLine, fMax);
277-
// we tried pre-loading a first chunk here but it was not faster
277+
// (we tried pre-loading a first chunk here but it was not faster)
278278
// run the thread workers
279279
core := 0;
280280
cores := SystemInfo.dwNumberOfProcessors;

entries/abouchez/src/brcmormotfullcheck.lpr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ procedure ParseLine(var chunk: TBrcChunk); nostackframe; assembler;
117117
setne dl
118118
mov eax, dword ptr [r8 + 1] // eax = xx.x or x.x
119119
shl cl, 3
120-
lea r8, [r8 + rdx + 6] // r8 = next line
120+
lea r8, [r8 + rdx + 5] // r8 = next line
121121
shl eax, cl // normalized as xx.x
122122
and eax, $0f000f0f // from ascii to digit
123123
imul rax, rax, 1 + 10 shl 16 + 100 shl 24
@@ -208,7 +208,7 @@ procedure ParseLine(var chunk: TBrcChunk); inline;
208208
// branchless parsing of the temperature
209209
neg := ord(p[1] <> '-') * 2 - 1; // neg = +1 or -1
210210
inc(p, ord(p[1] = '-')); // ignore '-' sign
211-
chunk.Start := @p[ord(p[2] <> '.') + 6]; // next line
211+
chunk.Start := @p[ord(p[2] <> '.') + 5]; // next line
212212
chunk.Value := PtrInt(cardinal((QWord((PCardinal(p + 1)^ shl
213213
(byte(ord(p[2] = '.') shl 3))) and $0f000f0f) *
214214
(1 + 10 shl 16 + 100 shl 24)) shr 24) and cardinal(1023)) * neg;

entries/abouchez/src/brcmormotold.lpr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,12 @@ procedure TBrcThread.Execute;
306306
begin
307307
// note: the PCardinal(p)^ + "shr and $ff" trick is actually slower
308308
v := (p[0] * 100 + p[1] * 10 + p[3] - (ord('0') * 111)) * neg;
309-
p := @p[6]; // also jump ending $13/$10
309+
p := @p[5]; // also jump ending $10
310310
end
311311
else
312312
begin
313313
v := (p[0] * 10 + p[2] - (ord('0') * 11)) * neg; // x.x
314-
p := @p[5];
314+
p := @p[4];
315315
end;
316316
// store the value
317317
{$ifdef CUSTOMHASH}

entries/abouchez/src/brcmormotpertheadht.lpr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ procedure ParseLine(var chunk: TBrcChunk); nostackframe; assembler;
112112
setne dl
113113
mov eax, dword ptr [r8 + 1] // eax = xx.x or x.x
114114
shl cl, 3
115-
lea r8, [r8 + rdx + 6] // r8 = next line
115+
lea r8, [r8 + rdx + 5] // r8 = next line
116116
shl eax, cl // normalized as xx.x
117117
and eax, $0f000f0f // from ascii to digit
118118
imul rax, rax, 1 + 10 shl 16 + 100 shl 24
@@ -164,7 +164,7 @@ procedure ParseLine(var chunk: TBrcChunk); inline;
164164
// branchless parsing of the temperature
165165
neg := ord(p[1] <> '-') * 2 - 1; // neg = +1 or -1
166166
inc(p, ord(p[1] = '-')); // ignore '-' sign
167-
chunk.Start := @p[ord(p[2] <> '.') + 6]; // next line
167+
chunk.Start := @p[ord(p[2] <> '.') + 5]; // next line
168168
chunk.Value := PtrInt(cardinal((QWord((PCardinal(p + 1)^ shl
169169
(byte(ord(p[2] = '.') shl 3))) and $0f000f0f) *
170170
(1 + 10 shl 16 + 100 shl 24)) shr 24) and cardinal(1023)) * neg;

entries/abouchez/src/brcmormotsharedht.lpr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,12 +411,12 @@ procedure TBrcThread.Execute;
411411
begin
412412
// note: the PCardinal(p)^ + "shr and $ff" trick is actually slower
413413
v := (p[0] * 100 + p[1] * 10 + p[3] - (ord('0') * 111)) * neg;
414-
p := @p[6]; // also jump ending $13/$10
414+
p := @p[5]; // also jump ending $13/$10
415415
end
416416
else
417417
begin
418418
v := (p[0] * 10 + p[2] - (ord('0') * 11)) * neg; // x.x
419-
p := @p[5];
419+
p := @p[4];
420420
end;
421421
// store the value
422422
if s^.Count = 0 then

0 commit comments

Comments
 (0)