I hereby claim:
- I am x100ex on github.
- I am aap (https://keybase.io/aap) on keybase.
- I have a public key ASCXWEe4dEfsXVnNXx4O2jgcow0kN0RRM_PHw5NhPL8Rlgo
To claim this, I am signing this object:
| #!/bin/bash | |
| abspath() { | |
| local thePath | |
| if [[ ! "$1" =~ ^/ ]] | |
| then | |
| thePath="$PWD/$1" | |
| else | |
| thePath="$1" | |
| fi |
| // https://schani.wordpress.com/2010/04/30/linear-vs-binary-search/ | |
| static int | |
| linear_4 (const int *arr, int n, int key) { | |
| int i = 0; | |
| while (i + 3 < n) { | |
| if (arr [i + 0] >= key) return i + 0; | |
| if (arr [i + 1] >= key) return i + 1; | |
| if (arr [i + 2] >= key) return i + 2; |
| // https://schani.wordpress.com/2010/04/30/linear-vs-binary-search/ | |
| static int | |
| linear_sentinel (const int *arr, int key) { | |
| int i = 0; | |
| for (;;) { | |
| if (arr [i] >= key) | |
| return i; | |
| ++i; |
| // https://schani.wordpress.com/2010/04/30/linear-vs-binary-search/ | |
| static int | |
| linear_sentinel_sse2 (const int *arr, int n, int key) { | |
| v4si *in_data = (v4si*)arr; | |
| v4si key4 = { key, key, key, key }; | |
| int i = 0; | |
| for (;;) { | |
| v4si tmp = __builtin_ia32_pcmpgtd128 (key4, in_data [i]); |
| // https://schani.wordpress.com/2010/04/30/linear-vs-binary-search/ | |
| static int | |
| linear_sentinel_sse2_nobranch (const int *arr, int n, int key) { | |
| v4si *in_data = (v4si*)arr; | |
| v4si key4 = { key, key, key, key }; | |
| int i = 0; | |
| for (;;) { | |
| v4si cmp0 = __builtin_ia32_pcmpgtd128 (key4, in_data [i + 0]); |
| // https://schani.wordpress.com/2010/04/30/linear-vs-binary-search/ | |
| static int | |
| binary (const int *arr, int n, int key) { | |
| int min = 0, max = n; | |
| while (min < max) { | |
| int middle = (min + max) >> 1; | |
| if (key > arr [middle]) | |
| min = middle + 1; |
| // https://schani.wordpress.com/2010/04/30/linear-vs-binary-search/ | |
| static int | |
| binary_cmov (const int *arr, int n, int key) { | |
| int min = 0, max = n; | |
| while (min < max) { | |
| int middle = (min + max) >> 1; | |
| asm ("cmpl %3, %2\n\tcmovg %4, %0\n\tcmovle %5, %1" | |
| : "+r" (min), |
I hereby claim:
To claim this, I am signing this object:
| // C compiler check for structure size | |
| // from: http://bytes.com/topic/c/answers/220022-if-sizeof | |
| #define _x_CCASERT_LINE_CAT(predicate, line) typedef char constraint_violated_on_line_##line[2*((predicate) != 0)-1]; | |
| #define CCASSERT(predicate) _x_CCASERT_LINE_CAT(predicate, __LINE__) | |
| // Usage: CCASSERT(1) to pass; CCASSERT(0) to fail | |
| /* | |
| typedef struct { | |
| long x; |