Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use bool for predicates #407

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Use bool for predicates #407

wants to merge 9 commits into from

Conversation

bettio
Copy link
Collaborator

@bettio bettio commented Nov 14, 2022

Signed-off-by: Davide Bettio davide@uninstall.it

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

Copy link
Collaborator

@pguyot pguyot left a comment

Choose a reason for hiding this comment

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

We are also missing term_is_float

src/libAtomVM/term.h Outdated Show resolved Hide resolved
src/libAtomVM/term.h Outdated Show resolved Hide resolved
src/libAtomVM/term.h Show resolved Hide resolved
src/libAtomVM/term.h Show resolved Hide resolved
src/libAtomVM/term.h Show resolved Hide resolved
src/libAtomVM/term.h Outdated Show resolved Hide resolved
src/libAtomVM/term.h Outdated Show resolved Hide resolved
src/libAtomVM/term.h Outdated Show resolved Hide resolved
src/libAtomVM/term.h Show resolved Hide resolved
@bettio bettio force-pushed the use-bools branch 2 times, most recently from 0a39ab3 to 5259fb4 Compare November 15, 2022 00:04
@pguyot
Copy link
Collaborator

pguyot commented Nov 15, 2022

Also term_is_number (can't comment on the line)

term.h wasn't using stdbool so predicate functions were returning int
instead of bool.
So change them to use instead bool.

Signed-off-by: Davide Bettio <davide@uninstall.it>
Use bool instead of int for predicates.

Signed-off-by: Davide Bettio <davide@uninstall.it>
Signed-off-by: Davide Bettio <davide@uninstall.it>
Avoid `if`s and use boolean expressions instead.

Signed-off-by: Davide Bettio <davide@uninstall.it>
Signed-off-by: Davide Bettio <davide@uninstall.it>
Use bool for predicates instead of int.

Signed-off-by: Davide Bettio <davide@uninstall.it>
Use bool for predicates instead of int.

Signed-off-by: Davide Bettio <davide@uninstall.it>
Use bool for predicates instead of int.

Signed-off-by: Davide Bettio <davide@uninstall.it>
Avoid `if`s and use boolean expressions instead.

Signed-off-by: Davide Bettio <davide@uninstall.it>
@bettio bettio marked this pull request as ready for review December 16, 2022 23:51
@bettio
Copy link
Collaborator Author

bettio commented Dec 16, 2022

This changes make sense from a theoretical point of view, from an empirical point of view they might slow down the generated binary.

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.

None yet

3 participants