Skip to content

Commit aecae87

Browse files
author
di
committed
[CROSS] win32 support :(
1 parent 4fae81a commit aecae87

3 files changed

Lines changed: 19 additions & 8 deletions

File tree

shared/std/memory.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include "memory.h"
22

3-
int memcmp(const void *s1, const void *s2, unsigned long count) {
3+
int memcmp(const void *s1, const void *s2, size_t count) {
44
const unsigned char *a = s1;
55
const unsigned char *b = s2;
6-
for (unsigned long i = 0; i < count; i++) {
6+
for (size_t i = 0; i < count; i++) {
77
if (a[i] != b[i]) return a[i] - b[i];
88
}
99
return 0;

shared/std/memory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ extern "C" {
44

55
#include "types.h"
66

7-
int memcmp(const void *s1, const void *s2, unsigned long count);
7+
int memcmp(const void *s1, const void *s2, size_t count);
88
void* memset(void* dest, int byte, size_t count);
99
void* memset32(void* dest, uint32_t val, size_t count);
1010
void* memcpy(void *dest, const void *src, uint64_t count);

shared/types.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,15 @@ extern "C" {
4343
} while(0)
4444

4545
typedef unsigned int uint32_t;
46-
typedef long unsigned int size_t;
47-
typedef unsigned long uint64_t;
48-
typedef unsigned long uintptr_t;
46+
#ifdef _WIN32
47+
typedef unsigned long long size_t;
48+
typedef unsigned long long uint64_t;
49+
typedef unsigned long long uintptr_t;
50+
#else
51+
typedef unsigned long int size_t;
52+
typedef unsigned long int uint64_t;
53+
typedef unsigned long int uintptr_t;
54+
#endif
4955
typedef unsigned short uint16_t;
5056
typedef unsigned char uint8_t;
5157

@@ -59,8 +65,13 @@ typedef unsigned char uint8_t;
5965
#define N_ARR(arr) (sizeof(arr)/sizeof((arr)[0]))
6066

6167
typedef signed int int32_t;
62-
typedef signed long int64_t;
63-
typedef signed long intptr_t;
68+
#ifdef _WIN32
69+
typedef signed long long int64_t;
70+
typedef signed long long intptr_t;
71+
#else
72+
typedef signed long int int64_t;
73+
typedef signed long int intptr_t;
74+
#endif
6475
typedef signed short int16_t;
6576
typedef signed char int8_t;
6677

0 commit comments

Comments
 (0)