From f613ab2c257ad42038ce2f78a8eb858cf840a3a5 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 9 Oct 2019 11:37:22 +0300 Subject: [PATCH] Implement matrix multiplication with pure Go Set suitable backend for GF127 arithmetic for Concat(), Sum() etc. --- gogf127/gogf127.go | 9 +++++---- tz/cpuid_x86.go | 2 +- tz/sl2.go | 35 +++++++++++++++++++++++++++++++---- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/gogf127/gogf127.go b/gogf127/gogf127.go index cff06a3..8ba33e9 100644 --- a/gogf127/gogf127.go +++ b/gogf127/gogf127.go @@ -160,23 +160,24 @@ func Add(a, b, c *GF127) { } // Mul sets c to a*b. +// TODO make it work in-place without allocations // TODO optimization: no need to perform shift by i every time, cache results func Mul(a, b, c *GF127) { - c[0] = 0 - c[1] = 0 + r := new(GF127) d := new(GF127) for i := uint(0); i < 64; i++ { if b[0]&(1<