This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "map.h" | |
| #include <assert.h> | |
| #include <string.h> | |
| #include <stdio.h> | |
| #define TEST_INT_PAIR(name, T, v1, v2) \ | |
| static void map_test_##name(void) { \ | |
| struct name map_of(T, T); \ | |
| struct name m = {}; \ | |
| bool ok = map_alloc(&m, 0); assert(ok); \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "map.h" | |
| #include <assert.h> | |
| #include <limits.h> | |
| #include <math.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <stdint.h> | |
| #undef MAP_DUMP_CONVERT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* This file is part of proquint: http://github.com/dsw/proquint . | |
| See License.txt for copyright and terms of use. */ | |
| /* | |
| Convert between proquint, hex, and decimal strings. | |
| Please see the article on proquints: http://arXiv.org/html/0901.4016 | |
| Daniel S. Wilkerson | |
| */ | |
| #include "proquint.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| /// Platform Independent unifying ViewRepresentable template to minimize #if #else #endif in SwiftUI code | |
| #if canImport(UIKit) | |
| import UIKit | |
| public typealias _BaseView = UIView | |
| public typealias PlatformViewRepresentable = UIViewRepresentable | |
| #else | |
| import AppKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| import WebKit | |
| import Foundation | |
| import SwiftUI | |
| //import Foundation | |
| #if os(iOS) | |
| import UIKit | |
| typealias OSWindow = UIWindow | |
| typealias OSView = UIView |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <alloca.h> | |
| #include <assert.h> | |
| #include <limits.h> // INT_MAX | |
| #include <stddef.h> | |
| #include <stdbool.h> | |
| #include <stdint.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> // malloc/calloc/realloc/free | |
| #include <string.h> // memcpy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* File: gpu.h */ | |
| #pragma once | |
| #ifndef GPU_H | |
| #define GPU_H | |
| #ifdef __cplusplus | |
| extern "C" { | |
| #endif | |
| #include "etc.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct _array { | |
| void* data; | |
| int count; | |
| int capacity; | |
| }; | |
| #define array_of(type) { \ | |
| type* data; \ | |
| int count; \ | |
| int capacity; \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <assert.h> | |
| #include <stdbool.h> | |
| #include <stdint.h> | |
| struct map { // single threaded use only | |
| const void** p; // p[n] | |
| size_t n; | |
| uint32_t m; // mask 0xFFFFFF for 3 bytes and 0xFFFFFFFFu for 4 bytes | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Linear Congruential Generator (LCG) and an XOR-based generator (XBG) | |
| // like xoroshiro or xoshiro | |
| static uint64_t random64(uint64_t* state) { | |
| // Linear Congruential Generator with inline mixing | |
| thread_local static bool initialized; | |
| if (!initialized) { initialized = true; *state |= 1; }; | |
| *state = (*state * 0xD1342543DE82EF95uLL) + 1; | |
| uint64_t z = *state; | |
| z = (z ^ (z >> 32)) * 0xDABA0B6EB09322E3uLL; |
NewerOlder