Skip to content

Instantly share code, notes, and snippets.

@deeagle
Last active April 10, 2025 10:58
Show Gist options
  • Select an option

  • Save deeagle/006b2d260e8931dd46cc84d734ecb04e to your computer and use it in GitHub Desktop.

Select an option

Save deeagle/006b2d260e8931dd46cc84d734ecb04e to your computer and use it in GitHub Desktop.

Revisions

  1. deeagle revised this gist Apr 10, 2025. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion main.go
    Original file line number Diff line number Diff line change
    @@ -19,5 +19,10 @@ func main() {
    xandy := x & y
    xory := x | y
    fmt.Printf("x & y = %3d - %s\n", xandy, strconv.FormatInt(int64(xandy), 2))
    fmt.Printf("y | y = %3d - %s\n", xory, strconv.FormatInt(int64(xory), 2))
    fmt.Printf("y | y = %3d - %s\n\n", xory, strconv.FormatInt(int64(xory), 2))

    xy := x + y
    xysl2 := xy >> 2
    fmt.Printf("x + y = %3d - %9s\n", xy, strconv.FormatInt(int64(xy), 2))
    fmt.Printf("x + y >> 2 = %3d - %9s\n", xysl2, strconv.FormatInt(int64(xysl2), 2))
    }
  2. deeagle created this gist Apr 10, 2025.
    23 changes: 23 additions & 0 deletions main.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    package main

    import (
    "fmt"
    "strconv"
    )

    func main() {
    fmt.Println("hello")

    fmt.Printf("^2 index = %3d %2d %2d %2d %1d %1d %1d %1d\n", 8, 7, 6, 5, 4, 3, 2, 1)
    fmt.Printf("^2 result = %3d %2d %2d %2d %1d %1d %1d %1d\n\n", 128, 64, 32, 16, 8, 4, 2, 1)

    var x, y int = 100, 90

    fmt.Printf("x = %3d - %s\n", x, strconv.FormatInt(int64(x), 2))
    fmt.Printf("y = %3d - %s\n\n", y, strconv.FormatInt(int64(y), 2))

    xandy := x & y
    xory := x | y
    fmt.Printf("x & y = %3d - %s\n", xandy, strconv.FormatInt(int64(xandy), 2))
    fmt.Printf("y | y = %3d - %s\n", xory, strconv.FormatInt(int64(xory), 2))
    }