I'd probably do E.mapInPlace(buffer,buffer,function(x){return x-8}) : http://www.espruino.com/Reference#l_E_mapInPlace
E.mapInPlace(buffer,buffer,function(x){return x-8})
I think that's probably going to be one of the faster methods.
If you make sure you use Uint8ClampedArray then any value less than 0 won't wrap so will just end up at 0.
Uint8ClampedArray
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I'd probably do
E.mapInPlace(buffer,buffer,function(x){return x-8})
: http://www.espruino.com/Reference#l_E_mapInPlaceI think that's probably going to be one of the faster methods.
If you make sure you use
Uint8ClampedArray
then any value less than 0 won't wrap so will just end up at 0.