Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support not operation #24

Open
on99 opened this issue Apr 15, 2022 · 2 comments
Open

support not operation #24

on99 opened this issue Apr 15, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@on99
Copy link

on99 commented Apr 15, 2022

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

@kelindar kelindar added the enhancement New feature or request label Jun 4, 2022
@chippyash
Copy link

chippyash commented Sep 21, 2023

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants