Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

support bitwise operations on byte array #4

Closed
4 tasks done
rlespinasse opened this issue Oct 9, 2017 · 8 comments
Closed
4 tasks done

support bitwise operations on byte array #4

rlespinasse opened this issue Oct 9, 2017 · 8 comments

Comments

@rlespinasse
Copy link
Owner

rlespinasse commented Oct 9, 2017

Purpose

Support bitwise operations for a []byte value

Support

  • AND
  • OR
  • XOR
  • NOT

Function signatures

Bitwise AND

func Mask(data, mask []byte) []byte {}

Bitwise OR

func InclusiveMerge(data1, data2 []byte) []byte {}

Bitwise XOR

func ExclusiveMerge(data1, data2 []byte) []byte {}

Bitwise NOT

func Not(data []byte) []byte {}
@rlespinasse rlespinasse changed the title support bitwise operation on byte array support bitwise operations on byte array Oct 9, 2017
@blockloop
Copy link

🤔 can you give me a function signature of what you expect here?

@blockloop
Copy link

To be clear, I know what those operators are. Just not sure what this PR means specifically.

@rlespinasse
Copy link
Owner Author

rlespinasse commented Oct 11, 2017

@blockloop Good question, I update the issue with more information.
Tell me if you need more.

Have fun

@m4-miranda
Copy link

@rlespinasse this is my first contribution, so excuse the (possibly) dumb questions.
How I'd implement the AND function: iterate through each byte in the array and perform an AND operation on each. Is this right or am I missing something?

@rlespinasse
Copy link
Owner Author

rlespinasse commented Oct 13, 2017

@m4-miranda It's basically that. Just take in account, this AND function must support different size for the data and mask parameters. The data and the mask must be considerate as Little endian (see Issue purpose sections.)

Have fun

@rlespinasse
Copy link
Owner Author

For everybody, you can implement this issue partially if you want.
Just tell me what you want to do, before.

@rlespinasse
Copy link
Owner Author

No forks since 5 days, so the issue is "partially" taken anymore

@ulziibuyan
Copy link
Contributor

I would like to take this issue. Could you assign it to me, please?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants