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
0 | |
0 1.5 | |
0 0.5 | |
0.2 0.1 | |
0.5 0 | |
0.8 0.1 | |
1 0.5 | |
1 1.5 | |
0.8 1.9 | |
0.5 2 |
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
#include <iostream> | |
#include <vector> | |
#include <cstdint> | |
constexpr double decode_double(std::uint64_t encoded) { | |
bool s = encoded >> 63; | |
std::int16_t e = encoded >> 52 & 0x7FF; | |
std::int64_t m = encoded & (1ULL << 52) - 1; | |
if (e == 2047) return m ? s ? 0/0.0 : -(0/0.0) : s ? -1/0.0 : 1/0.0; | |
double x = m | (e ? 1ULL << 52 : 0); |
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
# Download latest archlinux bootstrap package, see https://www.archlinux.org/download/ | |
wget 'ftp://ftp.nluug.nl/pub/os/Linux/distr/archlinux/iso/latest/archlinux-bootstrap-*-x86_64.tar.gz' | |
# Make sure you'll have enough entropy for pacman-key later. | |
apt-get install haveged | |
# Install the arch bootstrap image in a tmpfs. | |
mount -t tmpfs none /mnt | |
cd /mnt | |
tar xvf ~/archlinux-bootstrap-*-x86_64.tar.gz --strip-components=1 |
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
#!/bin/sh | |
# Runs compton with a shader that only applies the opacity property to black | |
# backgrounds, with small soft shadows around non-black parts to inprove | |
# readability. | |
exec compton --backend glx --vsync --glx-fshader-win ' | |
uniform float opacity; | |
uniform sampler2D tex; | |
void main() { |
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
wget http://ftp.snt.utwente.nl/pub/software/gnu/binutils/binutils-2.29.tar.xz | |
wget ftp://ftp.nluug.nl/mirror/languages/gcc/releases/gcc-7.2.0/gcc-7.2.0.tar.xz | |
wget http://ftp.gnu.org/gnu/glibc/glibc-2.26.tar.xz | |
tar xvf binutils-2.29.tar.xz | |
tar xvf gcc-7.2.0.tar.xz | |
cd binutils-2.29 | |
./configure --target=armv7l-unknown-linux-gnueabihf --disable-multilib | |
make -j9 | |
sudo make install | |
cd .. |
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
ifeq (${VERBOSE},) | |
MAKEFLAGS += -s | |
endif | |
ifeq ($(OS),Windows_NT) | |
PY = py | |
else | |
PY = | |
endif |
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
include_directories(${CMAKE_CURRENT_BINARY_DIR}/generated) | |
#... | |
add_custom_target(version | |
COMMAND ${CMAKE_COMMAND} | |
ARGS | |
-DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/generated/version.h | |
-P ${CMAKE_CURRENT_SOURCE_DIR}/gen-version.cmake | |
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
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
.PHONY: .always | |
all: | |
Makefile: | |
# | |
build/build.ninja: | |
mkdir -p build | |
cd build && CXX='clang++ -fdiagnostics-color' CC='clang -fdiagnostics-color' cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -G Ninja |
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
The overview below shows all 6-bit floating point values using a sign bit, a 3-bit exponent and a 2-bit mantissa. | |
This should give you an idea of how floating point values work. The standard 32 bit and 64 bit floats | |
we all know are exactly the same, but just with more bits for both the exponent and mantissa. | |
S EEE MM | |
0 111 11 NaN | |
0 111 10 NaN | |
0 111 01 NaN | |
0 111 00 +Infinity |
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
//! Not tested! | |
extern crate alloc; | |
use alloc::{ | |
alloc::{realloc, Layout}, | |
collections::TryReserveError, | |
ffi::CString, | |
vec::{self, Drain}, | |
}; |