bitwise left shift



examples/bitwise-left-shift/bitwise_left_shift.go
package main

import "fmt"

func main() {
    x := 1
    for i := 0; i <= 8; i++ {
        y := x << i
        fmt.Printf("%3v %9b\n", y, y)
    }
    fmt.Println()

    a := 42
    fmt.Printf("%3v %9b", a, a)

}

  1         1
  2        10
  4       100
  8      1000
 16     10000
 32    100000
 64   1000000
128  10000000
256 100000000

 42    101010