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
// SSE returns the correct answer in Debug and Release | |
// AVX returns the correct answer in Debug but not Release | |
// This seems to be related to add_stuff being recursive | |
#[cfg(target_arch = "x86")] | |
use std::arch::x86::*; | |
#[cfg(target_arch = "x86_64")] | |
use std::arch::x86_64::*; | |
use std::fmt::Debug; |
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
using System; | |
using System.Diagnostics; | |
namespace ConsoleApp11 | |
{ | |
class Program | |
{ | |
static long count_for(int[] a1, int[] a2) | |
{ | |
long count = 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
#[macro_use] | |
extern crate criterion; | |
extern crate faster; | |
extern crate simdeez; | |
use criterion::Criterion; | |
use criterion::Fun; | |
use faster::*; | |
use simdeez::*; | |
use simdeez::sse2::*; |
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
namespace AlphaFront | |
module JsonCustomConverters = | |
open Newtonsoft.Json | |
open Microsoft.FSharp.Reflection | |
open System | |
open System.IO | |
type DuConverter() = | |
inherit JsonConverter() |
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
// An example of how tuples and treating if statements as expressions makes things nicer | |
// C version, a snippet from simlpex noise. | |
int i1, j1, k1; // Offsets for second corner of simplex in (i,j,k) coords | |
int i2, j2, k2; // Offsets for third corner of simplex in (i,j,k) coords | |
if (x0 >= y0) { | |
if (y0 >= z0) { | |
i1 = 1; j1 = 0; k1 = 0; i2 = 1; j2 = 1; k2 = 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
//represents an AST - such as Plus(Sin(x),y) | |
pub enum Op { | |
Plus ( Vec<Op> ), | |
Sin ( Vec<Op> ), | |
X, | |
Y, | |
Constant (f32), | |
Empty | |
} |
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
vertices := []float32{ | |
-0.5, -0.5, -0.5, 0.0, 0.0, | |
0.5, -0.5, -0.5, 1.0, 0.0, | |
0.5, 0.5, -0.5, 1.0, 1.0, | |
0.5, 0.5, -0.5, 1.0, 1.0, | |
-0.5, 0.5, -0.5, 0.0, 1.0, | |
-0.5, -0.5, -0.5, 0.0, 0.0, | |
-0.5, -0.5, 0.5, 0.0, 0.0, | |
0.5, -0.5, 0.5, 1.0, 0.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
func imgFileToTexture(renderer *sdl.Renderer, filename string) *sdl.Texture { | |
infile, err := os.Open(filename) | |
if err != nil { | |
panic(err) | |
} | |
defer infile.Close() | |
img, err := png.Decode(infile) | |
if err != nil { |
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
package main | |
import ( | |
"github.com/jackmott/rpg/game" | |
"github.com/jackmott/rpg/ui2d" | |
) | |
func main() { | |
game := game.NewGame(1, "game/maps/level1.map") |
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
type Node interface { | |
Eval(x, y float32) float32 | |
String() string | |
SetParent(parent Node) | |
GetParent() Node | |
GetChildren() []Node | |
SetChildren([]Node) | |
AddRandom(node Node) | |
AddLeaf(leaf Node) bool | |
NodeCount() int |