Commits

Eric Roshan Eisner committed 561ba93 Draft

use variable-exchange syntax in block calculation

benchmark old ns/op new ns/op delta
BenchmarkHash8Bytes 1992 1964 -1.41%
BenchmarkHash1K 10676 10615 -0.57%
BenchmarkHash8K 76977 76597 -0.49%

  • Participants
  • Parent commits 959e3b1

Comments (0)

Files changed (2)

 
 		// Rho Pi
 		t = st[1]
-
-		bc0 = st[10]
-		st[10] = t<<1 | t>>(64-1)
-		t = bc0
-		bc0 = st[7]
-		st[7] = t<<3 | t>>(64-3)
-		t = bc0
-		bc0 = st[11]
-		st[11] = t<<6 | t>>(64-6)
-		t = bc0
-		bc0 = st[17]
-		st[17] = t<<10 | t>>(64-10)
-		t = bc0
-		bc0 = st[18]
-		st[18] = t<<15 | t>>(64-15)
-		t = bc0
-		bc0 = st[3]
-		st[3] = t<<21 | t>>(64-21)
-		t = bc0
-		bc0 = st[5]
-		st[5] = t<<28 | t>>(64-28)
-		t = bc0
-		bc0 = st[16]
-		st[16] = t<<36 | t>>(64-36)
-		t = bc0
-		bc0 = st[8]
-		st[8] = t<<45 | t>>(64-45)
-		t = bc0
-		bc0 = st[21]
-		st[21] = t<<55 | t>>(64-55)
-		t = bc0
-		bc0 = st[24]
-		st[24] = t<<2 | t>>(64-2)
-		t = bc0
-		bc0 = st[4]
-		st[4] = t<<14 | t>>(64-14)
-		t = bc0
-		bc0 = st[15]
-		st[15] = t<<27 | t>>(64-27)
-		t = bc0
-		bc0 = st[23]
-		st[23] = t<<41 | t>>(64-41)
-		t = bc0
-		bc0 = st[19]
-		st[19] = t<<56 | t>>(64-56)
-		t = bc0
-		bc0 = st[13]
-		st[13] = t<<8 | t>>(64-8)
-		t = bc0
-		bc0 = st[12]
-		st[12] = t<<25 | t>>(64-25)
-		t = bc0
-		bc0 = st[2]
-		st[2] = t<<43 | t>>(64-43)
-		t = bc0
-		bc0 = st[20]
-		st[20] = t<<62 | t>>(64-62)
-		t = bc0
-		bc0 = st[14]
-		st[14] = t<<18 | t>>(64-18)
-		t = bc0
-		bc0 = st[22]
-		st[22] = t<<39 | t>>(64-39)
-		t = bc0
-		bc0 = st[9]
-		st[9] = t<<61 | t>>(64-61)
-		t = bc0
-		bc0 = st[6]
-		st[6] = t<<20 | t>>(64-20)
-		t = bc0
-		bc0 = st[1]
-		st[1] = t<<44 | t>>(64-44)
-		t = bc0
+		t, st[10] = st[10], t<<1|t>>(64-1)
+		t, st[7] = st[7], t<<3|t>>(64-3)
+		t, st[11] = st[11], t<<6|t>>(64-6)
+		t, st[17] = st[17], t<<10|t>>(64-10)
+		t, st[18] = st[18], t<<15|t>>(64-15)
+		t, st[3] = st[3], t<<21|t>>(64-21)
+		t, st[5] = st[5], t<<28|t>>(64-28)
+		t, st[16] = st[16], t<<36|t>>(64-36)
+		t, st[8] = st[8], t<<45|t>>(64-45)
+		t, st[21] = st[21], t<<55|t>>(64-55)
+		t, st[24] = st[24], t<<2|t>>(64-2)
+		t, st[4] = st[4], t<<14|t>>(64-14)
+		t, st[15] = st[15], t<<27|t>>(64-27)
+		t, st[23] = st[23], t<<41|t>>(64-41)
+		t, st[19] = st[19], t<<56|t>>(64-56)
+		t, st[13] = st[13], t<<8|t>>(64-8)
+		t, st[12] = st[12], t<<25|t>>(64-25)
+		t, st[2] = st[2], t<<43|t>>(64-43)
+		t, st[20] = st[20], t<<62|t>>(64-62)
+		t, st[14] = st[14], t<<18|t>>(64-18)
+		t, st[22] = st[22], t<<39|t>>(64-39)
+		t, st[9] = st[9], t<<61|t>>(64-61)
+		t, st[6] = st[6], t<<20|t>>(64-20)
+		t, st[1] = st[1], t<<44|t>>(64-44)
 
 		//  Chi
 		bc0 = st[0]
 	// Rho Pi
 	t = st[1]`)
 	for i := 0; i < 24; i++ {
-		fmt.Fprintf(w, `
-		bc0 = st[%d]
-		st[%d] = t << %d | t >> (64-%d)
-		t = bc0`, piln[i], piln[i], rotc[i], rotc[i])
+		fmt.Fprintf(w, "t, st[%d] = st[%d], t<<%d|t>>(64-%d)\n",
+			piln[i], piln[i], rotc[i], rotc[i])
 	}
 }