Skip to content

Commit 79842e5

Browse files
authored
Merge pull request #274 from seija-amanojaku/fix-dc
examples: fix dc division
2 parents 50852fb + 2710df7 commit 79842e5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

examples/dc.b

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ li_len2(li) {
8989
extrn li_new, li_free, li_mul, li_lt;
9090
if (li_type(li) == LI_NUMTYPE) {
9191
auto i; i = li_new(1);
92-
auto r; r = 2;
92+
auto r; r = 1;
9393
auto two; two = li_new(2);
9494
auto one; one = li_new(1);
9595
while (1) {
9696
auto next; next = li_mul(i, two);
97-
if (!li_lt(next, li)) {
97+
if (!li_let(next, li)) {
9898
li_free(next);
9999
goto end;
100100
}
@@ -313,6 +313,8 @@ li_sub(li1, li2) {
313313
/* TODO: This method of exp/multiplication is slow! */
314314
li_exp(li1, li2) {
315315
if ((li1[0] == LI_NUMTYPE) & (li1[0] == LI_NUMTYPE)) {
316+
/* TODO: if bits used in both numbers < half of the system word size, then the result is
317+
* sure to fit in a singular word. */
316318
extrn li_free, li_lt, li_get, li_mul;
317319
auto sum;
318320
auto one;

0 commit comments

Comments
 (0)