-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- update docs - faster RNG for noise, fried - faster HSLA/RGBA conversion
- Loading branch information
Showing
15 changed files
with
125 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// +build !profile | ||
|
||
package main | ||
|
||
func startProfile() {} | ||
func stopProfile() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// +build profile | ||
|
||
package main | ||
|
||
import ( | ||
"log" | ||
"os" | ||
"runtime/pprof" | ||
) | ||
|
||
var ( | ||
cpuProfile *os.File | ||
memProfile *os.File | ||
) | ||
|
||
func startProfile() { | ||
var err error | ||
cpuProfile, err := os.Create("yeetgif-cpu.profile") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
pprof.StartCPUProfile(cpuProfile) | ||
memProfile, err := os.Create("yeetgif-mem.profile") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
pprof.WriteHeapProfile(memProfile) | ||
} | ||
|
||
func stopProfile() { | ||
pprof.StopCPUProfile() | ||
cpuProfile.Close() | ||
memProfile.Close() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
package gifmath | ||
|
||
import "math/big" | ||
import ( | ||
"math" | ||
"math/big" | ||
) | ||
|
||
func LCM(a, b int) int { | ||
var an, bn, z big.Int | ||
an.SetInt64(int64(a)) | ||
bn.SetInt64(int64(b)) | ||
return int(z.Mul(z.Div(&bn, z.GCD(nil, nil, &an, &bn)), &an).Int64()) | ||
} | ||
|
||
func RandomFloat32Signed(seed *int) float32 { | ||
*seed *= 16807 | ||
return math.Float32frombits((uint32(*seed)>>9)|0x40000000) - 3.0 | ||
} | ||
|
||
func RandomFloat32Unsigned(seed *int) float32 { | ||
*seed *= 16807 | ||
return math.Float32frombits((uint32(*seed)>>9)|0x3f800000) - 1.0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters