Skip to content

Instantly share code, notes, and snippets.

@alexluecke
Last active November 12, 2018 02:31
Show Gist options
  • Save alexluecke/b3aa9945abe939d192089dcf102dd376 to your computer and use it in GitHub Desktop.
Save alexluecke/b3aa9945abe939d192089dcf102dd376 to your computer and use it in GitHub Desktop.
package main
import (
"sync"
)
func Pic(dx, dy int) [][]uint8 {
pic := make([][]uint8, dy)
n := 1
wg := sync.WaitGroup{}
wg.Add(n)
for d := 0; d < n; d++ {
go func(s [][]uint8) {
for y, _ := range s {
s[y] = make([]uint8, dx)
for x := 0; x < dx; x++ {
s[y][x] = uint8(x ^ y)
}
}
wg.Done()
}(pic[dy*(d/n) : dy*((d+1)/n)])
}
wg.Wait()
return pic
}
func main() {
const (
dx = 1 << 16
dy = 1 << 16
)
Pic(dx, dy)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment