Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: elastos/Elastos.ELA.SideChain.ESC
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: GigameshGarages/BrookNet
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

There isn’t anything to compare.

elastos:master and GigameshGarages:master are entirely different commit histories.

Showing with 32 additions and 0 deletions.
  1. +32 −0 contracts/fusion/contract/ArrayLib.sol
32 changes: 32 additions & 0 deletions contracts/fusion/contract/ArrayLib.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
pragma solidity ^0.4.19;

library ArrayLib {
function remove(uint256[] storage _array, uint256 _value)
internal
returns (bool success)
{
int256 index = indexOf(_array, _value);
if (index == -1) {
return false;
}
uint256 lastElement = _array[_array.length - 1];
_array[uint256(index)] = lastElement;

delete _array[_array.length - 1];
_array.length -= 1;
return true;
}

function indexOf(uint256[] _array, uint256 _value)
internal
pure
returns(int256 index)
{
for (uint256 i = 0; i < _array.length; i++) {
if (_array[i] == _value) {
return int256(i);
}
}
return -1;
}
}