mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
.cosmetics
This commit is contained in:
parent
72c7cda907
commit
ce70b04aa8
2 changed files with 5 additions and 20 deletions
|
|
@ -31,7 +31,6 @@ int CountLinesOptimized(Stream& s)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef CPU_SIMD
|
||||
int CountLinesOptimizedSIMD(Stream& s)
|
||||
{
|
||||
int n = 0;
|
||||
|
|
@ -40,19 +39,8 @@ int CountLinesOptimizedSIMD(Stream& s)
|
|||
int sz;
|
||||
const byte* p = s.GetSzPtr(sz);
|
||||
|
||||
if (sz) {
|
||||
const byte* e = p + sz;
|
||||
const byte* e16 = p + (sz & ~15); // Process in 16-byte chunks
|
||||
i8x16 q = i8all('\n');
|
||||
while(p < e16) {
|
||||
n += CountTrue(i8x16(p) == q);
|
||||
p += 16;
|
||||
}
|
||||
|
||||
while (p < e) { // Process remaining bytes (less than 16)
|
||||
n += (*p++ == '\n');
|
||||
}
|
||||
}
|
||||
if(sz)
|
||||
n += memcnt8(p, '\n', sz); // this is using SIMD..
|
||||
else {
|
||||
int c = s.Get();
|
||||
if(c < 0)
|
||||
|
|
@ -61,7 +49,6 @@ int CountLinesOptimizedSIMD(Stream& s)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
|
|
@ -85,11 +72,9 @@ CONSOLE_APP_MAIN
|
|||
RDUMP(CountLinesOptimized(in));
|
||||
}
|
||||
|
||||
#ifdef CPU_SIMD
|
||||
{
|
||||
RTIMESTOP("Optimized SIMD");
|
||||
RTIMESTOP("Optimized SIMD (using memcnt8)");
|
||||
FileIn in(arg[0]);
|
||||
RDUMP(CountLinesOptimizedSIMD(in));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -783,7 +783,7 @@ size_t memcnt16(const void *s, dword value, size_t sz)
|
|||
}
|
||||
#endif
|
||||
|
||||
while(p < e) // Process remaining bytes (less than 16)
|
||||
while(p < e) // Process remaining words (less than 8)
|
||||
n += (*p++ == value);
|
||||
return n;
|
||||
}
|
||||
|
|
@ -807,7 +807,7 @@ size_t memcnt32(const void *s, dword value, size_t sz)
|
|||
}
|
||||
#endif
|
||||
|
||||
while(p < e) // Process remaining bytes (less than 16)
|
||||
while(p < e) // Process remaining dwords (less than 4)
|
||||
n += (*p++ == value);
|
||||
return n;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue