Last active
August 29, 2015 14:13
-
-
Save headius/a4549a4073dcb36568ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@JRubyMethod(name = "fib_ruby", frame = true, required = 1, optional = 0, rest = false) | |
public static IRubyObject method__0$RUBY$fib_ruby( | |
final bench_fib_recursive bench_fib_recursive, | |
final ThreadContext threadContext, | |
final IRubyObject rubyObject, | |
final IRubyObject rubyObject2, | |
final Block block) { | |
if (bench_fib_recursive.getCallSite1().call(threadContext, rubyObject, rubyObject2, 2L).isTrue()) { | |
return rubyObject2 | |
} else { | |
return bench_fib_recursive.getCallSite2().call(threadContext, rubyObject, | |
bench_fib_recursive.getCallSite3().call(threadContext, rubyObject, rubyObject, | |
bench_fib_recursive.getCallSite4().call(threadContext, rubyObject, rubyObject2, 2L)), | |
bench_fib_recursive.getCallSite5().call(threadContext, rubyObject, rubyObject, | |
bench_fib_recursive.getCallSite6().call(threadContext, rubyObject, rubyObject2, 1L))); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fib_ruby(a) | |
if a < 2 | |
a | |
else | |
fib(a - 1) + fib(a - 2) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment