Don't get me wrong I like your algorithmic way better (it's probably faster too) but I have been on a kick lately trying to make things smaller. In case this is useful for anyone here is what I came up with in 6 lines. (probably better ways to do it too... bit shifting?)
Don't get me wrong I like your algorithmic way better (it's probably faster too) but I have been on a kick lately trying to make things smaller. In case this is useful for anyone here is what I came up with in 6 lines. (probably better ways to do it too... bit shifting?)
Use like: