This file contains 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
package bit_extension | |
import "core:intrinsics" | |
sign_extend :: #force_inline proc "contextless" ($D: typeid, src: $S) -> D where | |
intrinsics.type_is_integer(D) && | |
intrinsics.type_is_integer(S) && | |
size_of(D) >= size_of(S) | |
{ | |
when size_of(S) == size_of(i128) { |
This file contains 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
package evil_goto | |
import "core:fmt" | |
import "core:mem" | |
import "core:sys/windows" | |
label: proc"c"()->rawptr | |
goto: proc"c"(rawptr)->! | |
__setup := proc() -> int { |
This file contains 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
step :: inline proc(using hart: ^Hart) { | |
using instr := decode((^u32)(&memory[pc])^); | |
next_pc := pc + size_of(u32); | |
nulltarget: u64 = ---; | |
dst := rd < 32 && rd > 0 ? ®isters[rd] : &nulltarget; | |
switch mask { | |
case LUI: (^i64)(dst)^ = i64(imm); |
This file contains 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
https://cognitivedemons.wordpress.com/2017/07/06/a-neural-network-in-10-lines-of-c-code/ |
This file contains 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
foreign import lua_c "lua53.lib" | |
// @todo: add luajit support | |
// @ref: https://www.lua.org/manual/5.3/manual.html#4 | |
// @ref: | |
// @region luaconf.h |