Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

network/bitvector: Multibit set/unset + string rep #1530

Merged
merged 5 commits into from
Jul 2, 2019

Conversation

nolash
Copy link
Contributor

@nolash nolash commented Jul 2, 2019

Adaptive capabilities' use of bitvectors require setting multiple bits in one command, and also string output for logging. This PR adds this functionality to the bitvector package as a preparatory step.

nonsense
nonsense previously approved these changes Jul 2, 2019
Copy link
Contributor

@nonsense nonsense left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@nonsense
Copy link
Contributor

nonsense commented Jul 2, 2019

@nolash I personally prefer naming methods, than using bool - Set, Unset was better IMO, than SetBytes (true,false)

// SetBytes modifies all bits in the bitvector that are set in the argument
//
// If v is true, it sets all bits in the bitvector that are set in the argument
// If v is false, it unsets all bites in the bitvector that are set in the argument
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo - bites -> bits.

Unset 1010101001 is easier to reason about than SetBytes 1010101001 false IMO.

Copy link
Contributor Author

@nolash nolash Jul 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it because the corresponding one for individual bits is Set(int, bool) - should we change that too, then? I think they should be the same.

And yes I agree Unset is better.

Copy link
Member

@janos janos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nolash nolash merged commit a6e64ae into ethersphere:master Jul 2, 2019
@nolash nolash deleted the adaptive-bitvector-convenience branch July 2, 2019 16:08
@skylenet skylenet added this to the 0.4.3 milestone Jul 4, 2019
vojtechsimetka added a commit that referenced this pull request Jul 9, 2019
* master:
  network/newstream: new stream! protocol base implementation (#1500)
  swarm: fix bzz_info.port when using dynamic port allocation (#1537)
  cmd/swarm: make bzzaccount flag optional and add bzzkeyhex flag (#1531)
  cmd/swarm: remove separate function to parse env vars (#1536)
  network/bitvector: Multibit set/unset + string rep (#1530)
  swarm: 0.4.3 unstable (#1526)
  travis: also build on release tags (#1527)
  swarm: release v0.4.2 (#1496)
  network: bump bzz stream hive (#1522)
  docker: update ca-certificates file (#1525)
  Add swarm guide to /docs (#1513)
  network/simulation: Add ExecAdapter capability to swarm simulations (#1503)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants