Memalign/sysconf fixes for mingw/windows (thanks to @iceman1001)

This commit is contained in:
Aram
2017-03-19 19:55:02 +01:00
parent 173a351b21
commit 993f687528
3 changed files with 25 additions and 4 deletions

View File

@ -4,7 +4,9 @@
#include <stdint.h>
#include <unistd.h>
#include <pthread.h>
#ifndef __WIN32
#include <sys/sysinfo.h>
#endif
#include "craptev1.h"
#include "crypto1_bs.h"
#include "crypto1_bs_crack.h"
@ -44,7 +46,7 @@ uint64_t *readnonces(char* fname){
}
uint32_t **space;
size_t thread_count;
size_t thread_count = 1;
void* crack_states_thread(void* x){
const size_t thread_id = (size_t)x;
@ -72,7 +74,10 @@ int main(int argc, char* argv[]){
space = craptev1_get_space(nonces, 95, uid);
total_states = craptev1_sizeof_space(space);
thread_count = get_nprocs_conf();
#ifndef __WIN32
thread_count = sysconf(_SC_NPROCESSORS_CONF);
#endif /* _WIN32 */
// append some zeroes to the end of the space to make sure threads don't go off into the wild
size_t j = 0;
for(j = 0; space[j]; j+=5){