Commit aa8601e8 authored by John Esmet's avatar John Esmet Committed by Yoni Fogel

[t:4955] fib was Zardosht's code, he doesn't want it anymore


git-svn-id: file:///svn/toku/tokudb@44066 c7de825b-a66e-492c-adef-691d508d4ae1
parent c032a40b
fib:
icc fiblib.c -fPIC -c -o fiblib.o; \
icc --shared fiblib.o -L../cilk_icc -lcilkrts_static -nodefaultlibs -olibfib.so; \
icc -L. -lfib -pthread -lstdc++ fib.c -o fib
clean:
rm -rf fib libfib.so fiblib.o
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: expandtab:ts=8:sw=4:softtabstop=4:
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include "fiblib.h"
int main (int argc, char *argv[]) {
assert(argc==2);
int n = atoi(argv[1]);
long fn = fib(n);
printf("fib(%d)=%ld\n", n, fn);
return 0;
}
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: expandtab:ts=8:sw=4:softtabstop=4:
#include "fiblib.h"
long fib (int n) {
if (n<=2) return n;
else {
long a,b;
a = _Cilk_spawn fib(n-1);
b = _Cilk_spawn fib(n-2);
_Cilk_sync;
return a+b;
}
}
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: expandtab:ts=8:sw=4:softtabstop=4:
long fib (int n);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment