Skip to content

Instantly share code, notes, and snippets.

View (im)

Graphical User Interfaces

Last time I wrote a little bit about my current GUI research progress. There are some things that were misunderstood so I want to clarify some fundamental design decisions and finally write up some current problems and their solutions.

First up I want to clarify a component is not another term for what is usually refered to as widget. Instead wigets in this implementation are made out of n >= 1 components. Components themself are just rectangles with attributes left, right, top, bottom, center_x, center_y, width and height some behavior flags and an optional surface to draw into. For example a scroll regions is made up out of at least three

View fibers.c
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <string.h>
#define streq(a, b) (!strcmp((a), (b)))
#ifndef __USE_GNU
#define __USE_GNU
dwilliamson /
Last active Jan 2, 2022
Minimal Code Generation for STL-like Containers

This is my little Christmas-break experiment trying to (among other things) reduce the amount of generated code for containers.


The C++ STL is still an undesirable library for many reasons I have extolled in the past. But it's also a good library. Demons lie in this here debate and I have no interest in revisiting it right now.

The goals that I have achieved with this approach are:

rygorous / gist:2156668
Last active Sep 29, 2022
float->half variants
View gist:2156668
// float->half variants.
// by Fabian "ryg" Giesen.
// I hereby place this code in the public domain, as per the terms of the
// CC0 license:
// float_to_half_full: This is basically the ISPC stdlib code, except
// I preserve the sign of NaNs (any good reason not to?)
rygorous / gist:2144712
Created Mar 21, 2012
half->float variants
View gist:2144712
// half->float variants.
// by Fabian "ryg" Giesen.
// I hereby place this code in the public domain.
// half_to_float_fast: table based
// tables could be done in a more compact fashion (in particular, can store tab2 in low word of tab1!)
// but something of a dead end since not very SIMD-friendly. pretty much abandoned at this point.
// half_to_float_fast2: use FP adder hardware to deal with denormals.