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