mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-05 07:36:14 +08:00
chg: copied from pm3 repo
This commit is contained in:
parent
cb56ca37ff
commit
af47a3fd34
1 changed files with 19 additions and 6 deletions
|
@ -93,6 +93,24 @@ const uint64_t unbitslice(const bitslice_t *restrict b, const uint8_t s, const u
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// determine number of logical CPU cores (use for multithreaded functions)
|
||||||
|
static int num_CPUs(void) {
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#include <sysinfoapi.h>
|
||||||
|
SYSTEM_INFO sysinfo;
|
||||||
|
GetSystemInfo(&sysinfo);
|
||||||
|
return sysinfo.dwNumberOfProcessors;
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
int count = sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
|
if (count < 2)
|
||||||
|
count = 2;
|
||||||
|
return count;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t uid, nR1, aR1, nR2, aR2;
|
uint32_t uid, nR1, aR1, nR2, aR2;
|
||||||
|
|
||||||
uint64_t candidates[(1 << 20)];
|
uint64_t candidates[(1 << 20)];
|
||||||
|
@ -116,12 +134,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
uint32_t target = 0;
|
uint32_t target = 0;
|
||||||
|
|
||||||
#ifndef __WIN32
|
thread_count = num_CPUs();
|
||||||
thread_count = sysconf(_SC_NPROCESSORS_CONF);
|
|
||||||
if (thread_count < 2)
|
|
||||||
thread_count = 2;
|
|
||||||
#endif /* _WIN32 */
|
|
||||||
|
|
||||||
|
|
||||||
if (!strncmp(argv[1], "0x", 2) || !strncmp(argv[1], "0X", 2)) {
|
if (!strncmp(argv[1], "0x", 2) || !strncmp(argv[1], "0X", 2)) {
|
||||||
uid = rev32(hexreversetoulong(argv[1] + 2));
|
uid = rev32(hexreversetoulong(argv[1] + 2));
|
||||||
|
|
Loading…
Reference in a new issue