You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe volatile was used to ensure that the compile does not optimize
the code in ways that break the bit manipulation. Switching to memcpy
and using the built-in bswap implementations when available seems
like a better way to solve the issue.
This also fixes the following warning:
```
/home/greg/MaxMind/MaxMindDBSwift/Sources/CLibMaxMindDB/libmaxminddb-1.12.2/src/maxminddb.c:1781:12: warning: passing 'volatile uint8_t *' (aka 'volatile unsigned char *') to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
1781 | memcpy(q, p, 4);
| ^
/usr/include/string.h:43:39: note: passing argument to parameter '__dest' here
43 | extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
| ^
/home/greg/MaxMind/MaxMindDBSwift/Sources/CLibMaxMindDB/libmaxminddb-1.12.2/src/maxminddb.c:1799:12: warning: passing 'volatile uint8_t *' (aka 'volatile unsigned char *') to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
1799 | memcpy(q, p, 8);
| ^
/usr/include/string.h:43:39: note: passing argument to parameter '__dest' here
43 | extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
| ^
2 warnings generated.
```
0 commit comments