function log (message)
local msg = message or ""
editor.flashNotification(msg)
print(msg)
end
git = {}
| /* float to decimal string, exact conversion; tested for all possible inputs against mingw 4.0 sprintf with define _XOPEN_SOURCE 1 | |
| tei.andu@tutanota.com | |
| */ | |
| typedef union { | |
| float f; | |
| uint32_t u32; | |
| struct { | |
| uint32_t m:23; | |
| uint32_t x:8; |
function log (message)
local msg = message or ""
editor.flashNotification(msg)
print(msg)
end
git = {}
| #ident "@(#) Object.h, Rev 2.10, 96/08/02" | |
| // | |
| // Copyright (c) 1995-1996, Sun Microsystems, Inc. | |
| // portions (c) Copyright 1988, 1989 NeXT, Inc. | |
| // All rights reserved. | |
| #ifndef _OBJC_OBJECT_H_ | |
| #define _OBJC_OBJECT_H_ | |
| #import <objc/objc.h> |
| /* | |
| =========================================================================== | |
| Common Lisp Interpreter – Bytecode-Based, Register-VM Architecture | |
| =========================================================================== | |
| This interpreter implements a minimal Common Lisp system featuring: | |
| 1. Reading: | |
| - Input: A text file. | |
| - Operations: Tokenization and application of reader macros (quotes, backquote/unquote, | |
| unquote-splicing, read-time evaluation). |
| // based on xxhash32 | |
| unsigned int hash(char *data, size_t len) | |
| { | |
| unsigned int hash; | |
| if (len < 4) { | |
| // load 3 bytes, overlapping if len < 3 | |
| static unsigned char offset1[4] = { 0,0,1,1 }; | |
| static unsigned char offset2[4] = { 0,0,0,2 }; | |
| unsigned int h = data[0] + (data[offset1[len]]<<8) + (data[offset2[len]]<<16); | |
| h = xxprime1 + h*xxprime2; |
| // NOTE Compile without fast math flags. | |
| /* | |
| This is free and unencumbered software released into the public domain. | |
| Anyone is free to copy, modify, publish, use, compile, sell, or | |
| distribute this software, either in source code form or as a compiled | |
| binary, for any purpose, commercial or non-commercial, and by any | |
| means. |
This downloads standalone MSVC compiler, linker & other tools, also headers/libraries from Windows SDK into portable folder, without installing Visual Studio. Has bare minimum components - no UWP/Store/WindowsRT stuff, just files & tools for native desktop app development.
Run py.exe portable-msvc.py and it will download output into msvc folder. By default it will download latest available MSVC & Windows SDK - currently v14.40.33807 and v10.0.26100.0.
You can list available versions with py.exe portable-msvc.py --show-versions and then pass versions you want with --msvc-version and --sdk-version arguments.
To use cl.exe/link.exe first run setup_TARGET.bat - after that PATH/INCLUDE/LIB env variables will be updated to use all the tools as usual. You can also use clang-cl.exe with these includes & libraries.
To use clang-cl.exe without running setup.bat, pass extra /winsysroot msvc argument (msvc is folder name where output is stored).
| #define STR2(x) #x | |
| #define STR(x) STR2(x) | |
| #ifdef __APPLE__ | |
| #define USTR(x) "_" STR(x) | |
| #else | |
| #define USTR(x) STR(x) | |
| #endif | |
| #ifdef _WIN32 |
| // Exact square root of a known square integer | |
| // =========================================== | |
| // This snippet contains a function `isqrt64_exact` with signature | |
| // | |
| // uint32_t isqrt64_exact(uint64_t n); | |
| // | |
| // `isqrt64_exact` computes the 32-bit square root of its unsigned 64-bit | |
| // integer input, under the assumption that that input is a perfect square. | |
| // | |
| // Compile under gcc or clang with: |
| struct Object { | |
| Key key; // The key is any piece of data that uniquely identifies the object. | |
| // ... | |
| }; | |
| struct Handle { | |
| Key key; | |
| Index index; // This caches a speculative table index for an object with the corresponding key. | |
| }; |