Skip to content

Instantly share code, notes, and snippets.

@igorburago
igorburago / xorab.c
Last active October 30, 2022 10:22
Finding all solutions of the equation x⊕(a-x)=b
#include <limits.h>
#include <stdio.h>
typedef unsigned uint;
uint
enum_bit(uint q, uint x, uint *xs) {
if (q == 0) {
*xs = x;
return 1;
@igorburago
igorburago / s.c
Last active October 30, 2022 10:22
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int
llcmp(const void *l, const void *r) {
return *(long long *)l - *(long long *)r;
}
enum {
@igorburago
igorburago / indentguides.vim
Last active October 30, 2022 10:16
Vim indentation guides emulation
" Simple emulation of indentation guides.
"
" For tab-based indentation, using the 'listchars' option works fine.
" For space-based indentation, one can either:
" • use the match highlighting feature (see ':help match-highlight'),
" as shown in ToggleMatchHighlightIndentGuides(); or
" • use the 'leadmultispace' setting of the 'listchars' option (added
" in Vim 9.0), as shown in ToggleListCharsIndentGuides().
"
" The mapping for toggling indentation guides will look like