one more code sample, and some corrections of a previous one
Two more instructions: log and bit, for easier bit manipulations