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

Side by Side Diff: perf/go/util/util.go

Issue 608273002: Add versioning to perf SQL database (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Incorporated Feedback 3 Created 6 years, 2 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
« perf/go/trybot/trybot.go ('K') | « perf/go/trybot/trybot.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package util 1 package util
2 2
3 import "sort" 3 import "sort"
4 4
5 func In(s string, a []string) bool { 5 func In(s string, a []string) bool {
6 for _, x := range a { 6 for _, x := range a {
7 if x == s { 7 if x == s {
8 return true 8 return true
9 } 9 }
10 } 10 }
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 // Since they are the same size we only need to check from one side, i.e . 40 // Since they are the same size we only need to check from one side, i.e .
41 // compare a's values to b's values. 41 // compare a's values to b's values.
42 for k, v := range a { 42 for k, v := range a {
43 if bv, ok := b[k]; !ok || bv != v { 43 if bv, ok := b[k]; !ok || bv != v {
44 return false 44 return false
45 } 45 }
46 } 46 }
47 return true 47 return true
48 } 48 }
49
50 // This is sad, but apparently there is no library function to get the absolute
51 // value of an int.
52 func AbsInt(v int) int {
53 if v < 0 {
54 return -v
55 }
56 return v
57 }
58
59 // Returns -1, 1 or 0 depending on the sign of v.
60 func SignInt(v int) int {
61 if v < 0 {
62 return -1
63 }
64 if v > 0 {
65 return 1
66 }
67 return 0
68 }
OLDNEW
« perf/go/trybot/trybot.go ('K') | « perf/go/trybot/trybot.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698