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