Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: third_party/go/src/golang.org/x/mobile/f32/gen.go

Issue 1275153002: Remove third_party/golang.org/x/mobile as it is no longer used with Go 1.5. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Remove golang.org/x/mobile Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // +build ignore
6
7 package main
8
9 /*
10 This program generates table.go. Invoke it as:
11 go run gen.go -output table.go
12 */
13
14 import (
15 "bytes"
16 "flag"
17 "fmt"
18 "go/format"
19 "io/ioutil"
20 "log"
21 "math"
22 )
23
24 // N is the number of entries in the sin look-up table. It must be a power of 2.
25 const N = 4096
26
27 var filename = flag.String("output", "table.go", "output file name")
28
29 func main() {
30 b := new(bytes.Buffer)
31 fmt.Fprintf(b, "// generated by go run gen.go; DO NOT EDIT\n\npackage f3 2\n\n")
32 fmt.Fprintf(b, "const sinTableLen = %d\n\n", N)
33 fmt.Fprintf(b, "// sinTable[i] equals sin(i * π / sinTableLen).\n")
34 fmt.Fprintf(b, "var sinTable = [sinTableLen]float32{\n")
35 for i := 0; i < N; i++ {
36 radians := float64(i) * (math.Pi / N)
37 fmt.Fprintf(b, "%v,\n", float32(math.Sin(radians)))
38 }
39 fmt.Fprintf(b, "}\n")
40
41 data, err := format.Source(b.Bytes())
42 if err != nil {
43 log.Fatal(err)
44 }
45 if err := ioutil.WriteFile(*filename, data, 0644); err != nil {
46 log.Fatal(err)
47 }
48 }
OLDNEW
« no previous file with comments | « third_party/go/src/golang.org/x/mobile/f32/f32_test.go ('k') | third_party/go/src/golang.org/x/mobile/f32/mat3.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698