projects
/
riscv-tests.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Simplify test_function_call.
[riscv-tests.git]
/
debug
/
programs
/
debug.c
diff --git
a/debug/programs/debug.c
b/debug/programs/debug.c
index 20b1cdcf29f18d6e042884f18c3f86ad915dde5a..3ba51bca9249cd768ee298515ac2456477eccdad 100644
(file)
--- a/
debug/programs/debug.c
+++ b/
debug/programs/debug.c
@@
-5,6
+5,24
@@
unsigned int crc32a(uint8_t *message, unsigned int size);
unsigned int crc32a(uint8_t *message, unsigned int size);
+unsigned int fib(unsigned int n)
+{
+ if (n == 0) {
+ return 0;
+ }
+
+ unsigned int a = 0;
+ unsigned int b = 1;
+
+ for (unsigned int i = 1; i < n; i++) {
+ unsigned int next = a + b;
+ a = b;
+ b = next;
+ }
+
+ return b;
+}
+
void rot13(char *buf)
{
while (*buf) {
void rot13(char *buf)
{
while (*buf) {