Commit fbea809
committed
Do not rely on volatile for double/float decoding
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.
```1 parent 67ca8a5 commit fbea809
2 files changed
+52
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
1 | 6 | | |
2 | 7 | | |
3 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1767 | 1767 | | |
1768 | 1768 | | |
1769 | 1769 | | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
1770 | 1800 | | |
1771 | | - | |
1772 | | - | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
1773 | 1806 | | |
1774 | 1807 | | |
1775 | 1808 | | |
1776 | | - | |
1777 | | - | |
1778 | | - | |
1779 | | - | |
1780 | | - | |
1781 | | - | |
| 1809 | + | |
1782 | 1810 | | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
1783 | 1814 | | |
1784 | 1815 | | |
1785 | 1816 | | |
1786 | 1817 | | |
1787 | | - | |
1788 | | - | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
1789 | 1823 | | |
1790 | | - | |
1791 | | - | |
1792 | | - | |
1793 | | - | |
1794 | | - | |
1795 | | - | |
1796 | | - | |
1797 | | - | |
1798 | | - | |
1799 | | - | |
| 1824 | + | |
1800 | 1825 | | |
1801 | 1826 | | |
| 1827 | + | |
| 1828 | + | |
1802 | 1829 | | |
1803 | 1830 | | |
1804 | 1831 | | |
| |||
0 commit comments