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