bitmap icon indicating copy to clipboard operation
bitmap copied to clipboard

support `not` operation

Open on99 opened this issue 3 years ago • 2 comments

is it possible to support not operation? https://en.wikipedia.org/wiki/Bitwise_operation#NOT

on99 avatar Apr 15 '22 02:04 on99

Not is fairly trivially implemented with

func Not(a bitmap.Bitmap) bitmap.Bitmap {
	var res bitmap.Bitmap
	a.Clone(&res)
	res.Ones()

	//rfunc clears bits in res if they are set in a
	rFunc := func(k uint32) {
		res.Remove(k)
	}

	a.Range(rFunc)
	return res
}

chippyash avatar Sep 21 '23 08:09 chippyash

The Not and other functions are implemented in https://github.com/chippyash/logicgate.git

chippyash avatar Sep 26 '23 05:09 chippyash