From fa44abdbe03cd8f1ae033b0469f3983ba564fe49 Mon Sep 17 00:00:00 2001 From: lkcl Date: Mon, 16 May 2022 08:53:30 +0100 Subject: [PATCH] --- openpower/sv/bitmanip.mdwn | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/openpower/sv/bitmanip.mdwn b/openpower/sv/bitmanip.mdwn index ee625e23e..10098a7b8 100644 --- a/openpower/sv/bitmanip.mdwn +++ b/openpower/sv/bitmanip.mdwn @@ -670,7 +670,23 @@ uint64_t bmator(uint64_t RA, uint64_t RB) } return x; } - +uint64_t bmatand(uint64_t RA, uint64_t RB) +{ + // transpose of RB + uint64_t RBt = bmatflip(RB); + uint8_t u[8]; // rows of RA + uint8_t v[8]; // cols of RB + for (int i = 0; i < 8; i++) { + u[i] = RA >> (i*8); + v[i] = RBt >> (i*8); + } + uint64_t x = 0; + for (int i = 0; i < 64; i++) { + if ((u[i / 8] & v[i % 8]) == 0xff) + x |= 1LL << i; + } + return x; +} ``` # Introduction to Carry-less and GF arithmetic -- 2.30.2