@@ -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 );
250250end ;
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;
0 commit comments