Most of the programs showed here are inspired by the book Hacker's Delight. While reading it, I start wondering if there wasn't a possibiity to create branch-free routines for date and time routines. The goal is to create routines that I could use on XMM, SSE etc... one routine for lots of data. Allthough easy in their coding, there weren't always easy to find and I even don't have a mathematic proof for them. It was trying, observing, re-trying and so one until I got for all data applicable the right solution. Lucky me there are just 12 months in a year. The routines for sleep and leapyear do have branches, which for leapyear I still am looking for another solution.
There are no libraries required, even better a static or shared library perhaps could be useful. All files are build with following makefile.
Downloading the source code can be done here on Github.
BIN=daysinmonth leapyear trimester quadrimester semester shiftedmonth sleep NASM=/usr/bin/nasm NASMOPTS=-felf64 NASMDBG=-Fdwarf .PHONY: all clean all: $(BIN) clean: rm -rf $(BIN).o $(BIN).dev.o $(BIN) %: %.asm %.c $(NASM) $(NASMOPTS) -o $@.o $< $(NASM) $(NASMOPTS) $(NASMDBG) -o $@.dev.o $< $(CC) -o $@ $@.c $@.o