Skip to content

Commit

Permalink
Update c docs
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Aug 15, 2024
1 parent 2ff9811 commit e654f76
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 3 deletions.
4 changes: 1 addition & 3 deletions c/src/include/fibonacci.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ uintmax_t advance_fibonacci(fibonacci *fib) {
return 0;
}
IterationHead(fib);
uintmax_t tmp = fib->a + fib->b;
fib->a = fib->b;
fib->b = tmp;
swap(fib->a, fib->b);
fib->exhausted = (tmp > fib->limit);
return fib->a;
}
Expand Down
6 changes: 6 additions & 0 deletions docs/src/c/lib/bcd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ bcd.h

View source code :source:`c/src/include/bcd.h`

Includes
--------

- `macros.h <./macros.html>`__
- `math.h <./math.html>`__ (if compiled on PCC)

This library implements a `Binary Coded Decimal <https://en.wikipedia.org/wiki/Binary-coded_decimal>`__ object in C. Mostly
this is done to prove that I could, but also because it allows for incredibly easy printing of arbitrary-sized integers.
It was also a good exercise in x86 assembly, as several portions are accellerated by handcrafted assembly.
Expand Down
7 changes: 7 additions & 0 deletions docs/src/c/lib/digits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ digits.h

View source code :source:`c/src/include/digits.h`

Includes
--------

- `iterator.h <./iterator.html>`__
- `macros.h <./macros.html>`__
- `math.h <./math.html>`__ (if compiled on PCC)

.. c:namespace-push:: digits
.. c:type:: digit_counter
Expand Down
6 changes: 6 additions & 0 deletions docs/src/c/lib/factors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ factors.h

View source code :source:`c/src/include/factors.h`

Includes
--------

- `iterator.h <./iterator.html>`__
- `macros.h <./macros.html>`__ (implicitly)

This file implements an :c:macro:`Iterator <IteratorHead>` that yields proper
factors for a given number. It is generally used by first calling
:c:func:`proper_divisor_count` and the :c:macro:`next`/:c:macro:`next_p` functions.
Expand Down
6 changes: 6 additions & 0 deletions docs/src/c/lib/fibonacci.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ fibonacci.h

View source code :source:`c/src/include/fibonacci.h`

Includes
--------

- `iterator.h <./iterator.html>`__
- `macros.h <./macros.html>`__ (implicitly)

.. c:namespace-push:: fibonacci
.. c:type:: fibonacci
Expand Down
10 changes: 10 additions & 0 deletions docs/src/c/lib/iterator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ iterator.h

View source code :source:`c/src/include/iterator.h`

Includes
--------

- `macros.h <./macros.html>`__

Includes
--------

- `macros.h <./macros.html>`__

.. c:namespace-push:: iterator
.. c:macro:: IteratorHead(return_type, struct_type)
Expand Down
5 changes: 5 additions & 0 deletions docs/src/c/lib/math.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ math.h

View source code :source:`c/src/include/math.h`

Includes
--------

- `macros.h <./macros.html>`__

.. c:namespace-push:: math
.. c:function:: uintmax_t factorial(unsigned int n)
Expand Down
7 changes: 7 additions & 0 deletions docs/src/c/lib/primes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ primes.h

View source code :source:`c/src/include/primes.h`

Includes
--------

- `iterator.h <./iterator.html>`__
- `macros.h <./macros.html>`__
- `math.h <./math.html>`__ (if compiled on PCC)

.. c:namespace-push:: primes
.. c:type:: prime_counter
Expand Down

0 comments on commit e654f76

Please sign in to comment.