1 |
TODO: naming of cutnions, index_to_coord, xy_to_s, xy_to_linear/seq, 32/64 |
2 |
TODO: returning packed coordinates, really |
3 |
TODO: support order=0? |
4 |
0x0001000c |
5 |
- added ecb_hilbert2d function family. |
6 |
- use __builtin_popcountl on 64 bit clang and gcc. |
7 |
- use 64 bit builtins, not 128 bit builtins, for ctz/clz on 64 bit cpus. |
8 |
- add ecb_clz* functions, |
9 |
- renamed ecb_gray* functions to have trailing bit width. |
10 |
- use ecb_function_ consistently for newly added functions. |
11 |
- say goodbye to gnu-style function definitions - they were not |
12 |
used consistently anyway, and imho make the code harder to read, |
13 |
and didn't even work for indented definitions. |
14 |
- windows/ms versions of clz returned the wrongt value (reported by b_honas). |
15 |
|
16 |
0x0001000b |
17 |
- added ecb_gray*_{de,en}code functions. |
18 |
|
19 |
0x0001000a |
20 |
- added ecb_ptrmix. |
21 |
|
22 |
0x00010009 |
23 |
- added ecb_i2a family of functions. |
24 |
- added ECB_64BIT_NATIVE. |
25 |
|
26 |
TODO: |
27 |
08:30:06 <b_jonas> I think it could be worth to add a macro that works like alignof or _Alignof on sane |
28 |
compilers, and like __alignof on MS compilers that support it, see |
29 |
http://msdn.microsoft.com/en-us/library/45t0s5f4.aspx |
30 |
08:30:24 <b_jonas> even if you can't support it on all the old compilers |
31 |
08:31:17 <b_jonas> I'd also like a macro for alignas, but sadly, that seems impossible in general, because |
32 |
the MS compiler only has some half-attempt to do something similar but with different and |
33 |
more broken semantics, see http://msdn.microsoft.com/en-us/library/83ythb65.aspx |
34 |
08:31:35 <b_jonas> but I wonder if some special case could still be worth to support |
35 |
08:32:23 <b_jonas> probably not, because it would just account to making a union with a highly aligned type, |
36 |
which is something I can do on any compiler portably |
37 |
|
38 |
TODO: #define ECB_IS_INTEGRAL(x) !((1 ? 1 : (x)) / 2) |
39 |
#define ECB_IS_INTEGRAL(x) (sizeof ((x) + 1.0f) != sizeof((x) + 1ULL)) |
40 |
|
41 |
TODO: ecb_minpot, either using bit tricks or ecb_ldXX |
42 |
|
43 |
TODO: __builtin_popcountll exists... |
44 |
|
45 |
TODO: __builtin_powi |
46 |
|
47 |
TODO: https://gustedt.wordpress.com/2010/06/08/detect-empty-macro-arguments/ |
48 |
|
49 |
implement is_constant for c11: https://gustedt.wordpress.com/2013/08/22/testing-compile-time-constness-and-null-pointers-with-c11s-_generic/ |
50 |
|
51 |
#ifdef _MSC_VER |
52 |
|
53 |
#include <stdlib.h> |
54 |
#define bswap_32(x) _byteswap_ulong(x) |
55 |
#define bswap_64(x) _byteswap_uint64(x) |
56 |
|
57 |
#elif defined(__APPLE__) |
58 |
|
59 |
// Mac OS X / Darwin features |
60 |
#include <libkern/OSByteOrder.h> |
61 |
#define bswap_32(x) OSSwapInt32(x) |
62 |
#define bswap_64(x) OSSwapInt64(x) |
63 |
|
64 |
#elif defined(__sun) || defined(sun) |
65 |
|
66 |
#include <sys/byteorder.h> |
67 |
#define bswap_32(x) BSWAP_32(x) |
68 |
#define bswap_64(x) BSWAP_64(x) |
69 |
|
70 |
#elif defined(__FreeBSD__) |
71 |
|
72 |
#include <sys/endian.h> |
73 |
#define bswap_32(x) bswap32(x) |
74 |
#define bswap_64(x) bswap64(x) |
75 |
|
76 |
#elif defined(__OpenBSD__) |
77 |
|
78 |
#include <sys/types.h> |
79 |
#define bswap_32(x) swap32(x) |
80 |
#define bswap_64(x) swap64(x) |
81 |
|
82 |
#elif defined(__NetBSD__) |
83 |
|
84 |
#include <sys/types.h> |
85 |
#include <machine/bswap.h> |
86 |
#if defined(__BSWAP_RENAME) && !defined(__bswap_32) |
87 |
#define bswap_32(x) bswap32(x) |
88 |
#define bswap_64(x) bswap64(x) |
89 |
#endif |
90 |
|
91 |
#else |
92 |
|
93 |
#include <byteswap.h> |
94 |
|
95 |
#endif |
96 |
|
97 |
TODO: generic poprcount etc., also fast_t for them? |
98 |
|
99 |
- allow any rotate count in rcb_rot*, at the expense |
100 |
of bad optimisation results on some platforms or with |
101 |
some word sizes. |
102 |
- try to use inttypes.h on mingw. |
103 |
|
104 |
0x00010008 |
105 |
- aligned/unaligned load/store, bswap, host order |
106 |
conversion. |
107 |
- generic C++ ecb_rot[lr], ecb_popcount, ecb_ctz, |
108 |
ecb_is_pot32 and ecb_bitrev functions. |
109 |
|
110 |
0x00010007 |
111 |
- new ECB_OPTIMIZE_SIZE symbol. |
112 |
|
113 |
0x00010006 |
114 |
- new ECB_MEMORY_FENCE_RELAXED memory fence. |
115 |
- use acquire/eelease memory barriers on sun workshop pro, not read/write. |
116 |
- rely on c++ compiler barriers to do the right thing in gcc/clang. |
117 |
- change release memory fence to memory barrier on ia32/ia64. |
118 |
- apply ctz/ld patch for msc by Zsbán Ambrus. |
119 |
- ECB_PTRSIZE erroneously was 8 on most 32bit systems ( |
120 |
found by Zsbán Ambrus). |
121 |
- improved compiletime detection of endianness, also, allow |
122 |
runtime detection to indicate other-than-big/little endianness. |
123 |
- no memory barrier neded on arm < 6. |
124 |
|
125 |
0x00010005 |
126 |
- improve ecb_binary16_to_float. |
127 |
- add ecb_float_to_binary16. |
128 |
- add ecb_binary16_to_binary32 and ecb_binary32_to_binary16 pair. |
129 |
|
130 |
0x00010001 |
131 |
- add ecb_is_pot32/64. |
132 |
- add intptr_t/uintptr_t. |
133 |
- add ECB_PTRSIZE. |
134 |
- more macros for C/C++ version checks. |
135 |
- support C11 atomics for memory fences. |
136 |
- support gcc-4.7 atomics for memory fences. |
137 |
- support m68k, m88k and sh (patch by Miod Vallat). |
138 |
- add ecb_binary16_to_float. |
139 |
|
140 |
TODO: ecb_restrict_array etc. http://ue.tst.eu/5093eafd713ec5fda776d8065070aa4c.txt |
141 |
TODO: ffs |
142 |
64 bit variants of everything |
143 |
TODO: examples from X for clz/ctz |
144 |
TODO: arithmetic right shift |
145 |
TODO: template/generic functions for x32/x64 and so on |
146 |
TODO: #define ecb_integer_multiples_of(n,d) ((char (*)[d])(n) - (char (*)[d])0) |
147 |
TODO: generalised shift |
148 |
TODO: #define ECB_FAST_UNALIGNED_ACCESS |
149 |
unsigned long gensh(unsigned long v, int x) { |
150 |
int a, b; |
151 |
a = (v << x) & -(((unsigned int)x) < 32); |
152 |
x = -x; |
153 |
b = (v >> x) & -(((unsigned int)x) < 32); |
154 |
return a|b; |
155 |
} |
156 |
|
157 |
TODO: export(=dllexport) & hidden |
158 |
TODO: flatten |
159 |
TODO: warning(msg) |
160 |
TODO: error(msg) |
161 |
TODO: leaf (uh), noclone (hmmm) |
162 |
TODO: nonnull, returns_nonnull |
163 |
TODO: nothrow |
164 |
TODO: used |
165 |
TODO: trap |
166 |
TODO: http://llvm.org/docs/doxygen/html/Compiler_8h_source.html |
167 |
|
168 |
TODO: read/write unaligned macros |
169 |
TODO: htonl and friends |
170 |
TODO: macro to convert from unsigned to signed "the natural way" |
171 |
TODO: ecb_static_assert, with message (just like boost), or somesuch, using array-declaration |
172 |
TODO: alignof |
173 |
|
174 |
|