aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/schellingcoin/quicksort.se
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-02-16 21:28:33 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-02-16 21:28:33 +0800
commit702218008ee2b6d708d6b2821cdef80736bb3224 (patch)
treed55ff7ce88187082378e7d8e4c2f3aad14d23b4e /Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/schellingcoin/quicksort.se
parent202362d9258335c695eb75f55f4be74a50a1af33 (diff)
downloadgo-tangerine-702218008ee2b6d708d6b2821cdef80736bb3224.tar.gz
go-tangerine-702218008ee2b6d708d6b2821cdef80736bb3224.tar.zst
go-tangerine-702218008ee2b6d708d6b2821cdef80736bb3224.zip
Add versioned dependencies from godep
Diffstat (limited to 'Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/schellingcoin/quicksort.se')
-rw-r--r--Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/schellingcoin/quicksort.se33
1 files changed, 33 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/schellingcoin/quicksort.se b/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/schellingcoin/quicksort.se
new file mode 100644
index 000000000..be5d97fc7
--- /dev/null
+++ b/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/schellingcoin/quicksort.se
@@ -0,0 +1,33 @@
+def kall():
+ argcount = ~calldatasize() / 32
+ if argcount == 1:
+ return(~calldataload(1))
+
+ args = array(argcount)
+ ~calldatacopy(args, 1, argcount * 32)
+ low = array(argcount)
+ lsz = 0
+ high = array(argcount)
+ hsz = 0
+ i = 1
+ while i < argcount:
+ if args[i] < args[0]:
+ low[lsz] = args[i]
+ lsz += 1
+ else:
+ high[hsz] = args[i]
+ hsz += 1
+ i += 1
+ low = self.kall(data=low, datasz=lsz, outsz=lsz)
+ high = self.kall(data=high, datasz=hsz, outsz=hsz)
+ o = array(argcount)
+ i = 0
+ while i < lsz:
+ o[i] = low[i]
+ i += 1
+ o[lsz] = args[0]
+ j = 0
+ while j < hsz:
+ o[lsz + 1 + j] = high[j]
+ j += 1
+ return(o, argcount)