[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Quick /g/, find and fix the bug or this bird is gonna stab you!

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 14
Thread images: 2

File: crow.jpg (181KB, 634x635px) Image search: [Google]
crow.jpg
181KB, 634x635px
#include <stdint.h>

/**
* @param n n
* @return d on success, -1 on failure
*/
int64_t f(uint8_t n)
{
if (n <= 1) return n;
/* if n is greater than 92, fail */
if (n > 92) return -1;
n -= 2;

uint64_t a = 1, b = 1, c = 0, d = 1, e = 1, f = 0;

while (n) {
uint64_t g, h;
if (n & 1) {
g = a * d + b * e;
h = b * d + c * e;
f = b * e + c * f;
d = g;
e = h;
}
g = a * b + b * c;
a = a * a + b * b;
c = b * b + c * c;
b = g;
n >>= 1;
}

/* return d */
return d;
}
>>
>>57519766
I'm not gonna do your homework, kid.
>>
>>57519766
>/**
> * @param n n
> * @return d on success, -1 on failure
> */
What amazingly helpful comments.
Anyway:
#include <stdint.h>

int64_t f(uint8_t n)
{
return 'd';
}
>>
>>57519781

please
>>
File: fixed bug.jpg (21KB, 600x399px) Image search: [Google]
fixed bug.jpg
21KB, 600x399px
>>
>>57519766
>Bug

I don't get it. What is the function supposed to do?
>>
>>57519837
are you really that stupid ? how much more comments and well chosen variable name do you need ?
>>
>>57519837
Return d.
>>
>>57519837
He took the effort to show us the original source code, and not the binary file. C'mon dude.
>>
>>57519837
It calculates Fibonacci numbers.
>>
4004b1: 55 push %rbp
4004b2: 48 89 e5 mov %rsp,%rbp
4004b5: 89 f8 mov %edi,%eax
4004b7: 88 45 bc mov %al,-0x44(%rbp)
4004ba: 80 7d bc 01 cmpb $0x1,-0x44(%rbp)
4004be: 77 09 ja 4004c9 <f+0x18>
4004c0: 0f b6 45 bc movzbl -0x44(%rbp),%eax
4004c4: e9 1f 01 00 00 jmpq 4005e8 <f+0x137>
4004c9: 80 7d bc 5c cmpb $0x5c,-0x44(%rbp)
4004cd: 76 0c jbe 4004db <f+0x2a>
4004cf: 48 c7 c0 ff ff ff ff mov $0xffffffffffffffff,%rax
4004d6: e9 0d 01 00 00 jmpq 4005e8 <f+0x137>
4004db: 80 6d bc 02 subb $0x2,-0x44(%rbp)
4004df: 48 c7 45 f8 01 00 00 movq $0x1,-0x8(%rbp)
4004e6: 00
4004e7: 48 c7 45 f0 01 00 00 movq $0x1,-0x10(%rbp)
4004ee: 00
4004ef: 48 c7 45 e8 00 00 00 movq $0x0,-0x18(%rbp)
4004f6: 00
4004f7: 48 c7 45 e0 01 00 00 movq $0x1,-0x20(%rbp)
4004fe: 00
4004ff: 48 c7 45 d8 01 00 00 movq $0x1,-0x28(%rbp)
400506: 00
400507: 48 c7 45 d0 00 00 00 movq $0x0,-0x30(%rbp)
40050e: 00
40050f: e9 c6 00 00 00 jmpq 4005da <f+0x129>
400514: 0f b6 45 bc movzbl -0x44(%rbp),%eax
400518: 83 e0 01 and $0x1,%eax
40051b: 85 c0 test %eax,%eax
40051d: 74 64 je 400583 <f+0xd2>
40051f: 48 8b 45 f8 mov -0x8(%rbp),%rax
400523: 48 0f af 45 e0 imul -0x20(%rbp),%rax
400528: 48 89 c2 mov %rax,%rdx
40052b: 48 8b 45 f0 mov -0x10(%rbp),%rax
40052f: 48 0f af 45 d8 imul -0x28(%rbp),%rax
400534: 48 01 d0 add %rdx,%rax
400537: 48 89 45 c8 mov %rax,-0x38(%rbp)
40053b: 48 8b 45 f0 mov -0x10(%rbp),%rax
40053f: 48 0f af 45 e0 imul -0
[/code]
>>
>>57519766
Won't puncture skin/10 I hope you don't plan on getting that done by midnight kiddo.
>>
BIRDMIN NO
>>
Fucking shit, return d when n <=1
Idiot
>>57519766
Thread posts: 14
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.