Skip to main content
deleted 18 characters in body
Source Link
user1095108
  • 907
  • 7
  • 19
uint8_t div3(uint8_t x) { uint8_t a = x - (x >> 2); x >>= 1; x = a - (x >> 3); x = a - (x >> 3); x = a - (x >> 3); return x >> 1; } 
uint8_t div3(uint8_t x) { uint8_t a = x - (x >> 2); x >>= 1; x = a - (x >> 3); x = a - (x >> 3); x = a - (x >> 3); return x >> 1; } 
uint8_t div3(uint8_t x) { uint8_t a = x - (x >> 2); x = a - (x >> 3); x = a - (x >> 3); x = a - (x >> 3); return x >> 1; } 
added 224 characters in body
Source Link
user1095108
  • 907
  • 7
  • 19

-- this one just approximates

uint8_t div3(uint8_t x) { uint8_t a = x - (x >> 2); x >>= 1; x = a - (x >> 3); x = a - (x >> 3); x = a - (x >> 3); return x >> 1; } 

-- this one just approximates

uint8_t div3(uint8_t x) { uint8_t a = x - (x >> 2); x >>= 1; x = a - (x >> 3); x = a - (x >> 3); x = a - (x >> 3); return x >> 1; } 
added 257 characters in body
Source Link
user1095108
  • 907
  • 7
  • 19

--

uint8_t div3(uint8_t x) { uint8_t a = x; x >>= 1; x = (a + (x >> 1)) >> 1; x = (a + (x >> 1)) >> 1; x = (a + (x >> 1)) >> 1; x = (a + (x >> 1) + 1) >> 1; return x >> 1; } 

--

uint8_t div3(uint8_t x) { uint8_t a = x; x >>= 1; x = (a + (x >> 1)) >> 1; x = (a + (x >> 1)) >> 1; x = (a + (x >> 1)) >> 1; x = (a + (x >> 1) + 1) >> 1; return x >> 1; } 
added 1 character in body
Source Link
user1095108
  • 907
  • 7
  • 19
Loading
added 163 characters in body
Source Link
user1095108
  • 907
  • 7
  • 19
Loading
added 40 characters in body
Source Link
user1095108
  • 907
  • 7
  • 19
Loading
edited body
Source Link
user1095108
  • 907
  • 7
  • 19
Loading
added 244 characters in body
Source Link
user1095108
  • 907
  • 7
  • 19
Loading
deleted 24 characters in body
Source Link
user1095108
  • 907
  • 7
  • 19
Loading
added 209 characters in body
Source Link
user1095108
  • 907
  • 7
  • 19
Loading
deleted 330 characters in body
Source Link
user1095108
  • 907
  • 7
  • 19
Loading
added 518 characters in body
Source Link
user1095108
  • 907
  • 7
  • 19
Loading
added 43 characters in body
Source Link
user1095108
  • 907
  • 7
  • 19
Loading
[Edit removed during grace period]
Source Link
user1095108
  • 907
  • 7
  • 19
Loading
added 26 characters in body
Source Link
user1095108
  • 907
  • 7
  • 19
Loading
deleted 6 characters in body
Source Link
user1095108
  • 907
  • 7
  • 19
Loading
added 288 characters in body
Source Link
user1095108
  • 907
  • 7
  • 19
Loading
added 60 characters in body
Source Link
user1095108
  • 907
  • 7
  • 19
Loading
added 330 characters in body
Source Link
user1095108
  • 907
  • 7
  • 19
Loading
Source Link
user1095108
  • 907
  • 7
  • 19
Loading