Skip to content

Conversation

@bettio
Copy link
Collaborator

@bettio bettio commented Oct 21, 2025

  • Add doxygen documentation to utils.h functions that have been introduced with feature/bigint branch.
  • Move bitshift utilities to utils.h.
  • Fix issue with 60-bits b operand in a bsr b and a bsl b

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

@bettio bettio force-pushed the utils-cleanup-and-doc branch from d31ec20 to 756d3ca Compare October 21, 2025 15:18
@bettio bettio changed the title Utils cleanup and doc utils.h: add doxygen doc and move to it bsl and bsr utils Oct 21, 2025
@bettio bettio changed the title utils.h: add doxygen doc and move to it bsl and bsr utils utils.h: add doxygen doc and move bsl and bsr utils to it Oct 21, 2025
}

/**
* @brief Perform arithmetic right shift on 32-bit signed integer (/c int32_t)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @brief Perform arithmetic right shift on 32-bit signed integer (/c int32_t)
* @brief Perform arithmetic right shift on 32-bit signed integer (\c int32_t)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

}

/**
* @brief Safely perform arithmetic right shift on 32-bit signed integer (/c int32_t)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @brief Safely perform arithmetic right shift on 32-bit signed integer (/c int32_t)
* @brief Safely perform arithmetic right shift on 32-bit signed integer (\c int32_t)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

These functions are general purpose helpers to avoid undefined
behaviours, so they can be used also outside of bif.c.

Signed-off-by: Davide Bettio <[email protected]>
Add doxygen documentation for functions such as int64_is_negative, etc...

Signed-off-by: Davide Bettio <[email protected]>
Keep variants (int32,int64) of the same function close together.

Signed-off-by: Davide Bettio <[email protected]>
Since avm_int_t is widely used around, such as for the shift parameter
in bsr and bsl, it is a safer option accepting size_t:
a positive avm_int_t can always be converted to size_t.

Also, make this assumption clear in term_typedef.h.

Signed-off-by: Davide Bettio <[email protected]>
@bettio bettio force-pushed the utils-cleanup-and-doc branch from 756d3ca to b0db34a Compare October 24, 2025 13:26
@bettio bettio merged commit 70519ec into atomvm:feature/bigint Oct 24, 2025
111 of 116 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants