kokke / kokke/tiny-bignum-c

add binary exponent return

Open
#36 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
474
Forks
90
PR merge metrics
No merged PRs in 30d

Description

int bignum_r_degree(struct bn* n)
{
int i = BN_ARRAY_SIZE;
while ((n->array[--i] == 0) && i);
int out = i * WORD_SIZE * 8;
out += 32 - __builtin_clz(n->array[i]);
return out;
}
Returns the number of bits used to write the number (!!!not the buffer size).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the bignum_r_degree entry point and reviewing how the bignum array stores words. Implement the requested bit-counting behavior where the issue's snippet belongs, then verify that the result reports the number of significant bits rather than the buffer size using the project's existing checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.