mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-19 09:25:12 -04:00
[checksum] more load balancing optimizations
* SetChecksumAffinity() now spreads the affinity evenly between cores * Also increase the read buffer size to help with performance * At this stage, the only limiting factor regarding performance seems to be the speed of the SHA-256 algorithm...
This commit is contained in:
parent
e6d3653cac
commit
e1c7c9670b
5 changed files with 77 additions and 46 deletions
28
src/stdio.c
28
src/stdio.c
|
@ -74,6 +74,34 @@ void _uprintf(const char *format, ...)
|
|||
}
|
||||
#endif
|
||||
|
||||
// Prints a bitstring of a number of any size, with or without leading zeroes.
|
||||
// See also the printbits() and printbitslz() helper macros in rufus.h
|
||||
char *_printbits(size_t const size, void const * const ptr, int leading_zeroes)
|
||||
{
|
||||
// sizeof(uintmax_t) so that we have enough space to store whatever is thrown at us
|
||||
static char str[sizeof(uintmax_t) * 8 + 3];
|
||||
size_t i;
|
||||
uint8_t* b = (uint8_t*)ptr;
|
||||
uintmax_t mask, lzmask = 0, val = 0;
|
||||
|
||||
// Little endian, the SCOURGE of any rational computing
|
||||
for (i = 0; i < size; i++)
|
||||
val |= ((uintmax_t)b[i]) << (8 * i);
|
||||
|
||||
str[0] = '0';
|
||||
str[1] = 'b';
|
||||
if (leading_zeroes)
|
||||
lzmask = 1ULL << (size * 8 - 1);
|
||||
for (i = 2, mask = 1ULL << (sizeof(uintmax_t) * 8 - 1); mask != 0; mask >>= 1) {
|
||||
if ((i > 2) || (lzmask & mask))
|
||||
str[i++] = (val & mask) ? '1' : '0';
|
||||
else if (val & mask)
|
||||
str[i++] = '1';
|
||||
}
|
||||
str[i] = '\0';
|
||||
return str;
|
||||
}
|
||||
|
||||
void DumpBufferHex(void *buf, size_t size)
|
||||
{
|
||||
unsigned char* buffer = (unsigned char*)buf;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue