After readjusting values in the speedtesting file, I have found that all std functions are 4 times faster than anything I have written, so for now I am unable to outdo these functions. I haven't given up though, I would like to see these software implementations at 2 times slower instead.