(b []byte)
| 33 | } |
| 34 | |
| 35 | func isPow2(b []byte) int { |
| 36 | seen1 := false |
| 37 | val := 0 |
| 38 | |
| 39 | for _, byteVal := range b { |
| 40 | for ii := 7; ii >= 0; ii-- { |
| 41 | bit := (byteVal >> ii) & 1 |
| 42 | if bit == 1 { |
| 43 | if !seen1 { |
| 44 | seen1 = true |
| 45 | continue |
| 46 | } else { |
| 47 | return -1 |
| 48 | } |
| 49 | } else { |
| 50 | if seen1 { |
| 51 | val++ |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | return val |
| 58 | } |
| 59 | |
| 60 | func isPow10(b []byte) int { |
| 61 | num := big.NewInt(0).SetBytes(b) |