Commit Graph

27 Commits

Author SHA1 Message Date
merge-script
b9cb1cbfd7 Merge bitcoin-core/secp256k1#1824: util: introduce and use ARRAY_SIZE macro
921b9711ea util: introduce and use `ARRAY_SIZE` macro (Sebastian Falbesoner)

Pull request description:

  This PR is another tiny improvement found while working on #1765, with the goal to avoid code repetition.

  The `ARRAY_SIZE` macro definition is pretty wide-spread in C projects and e.g. matches the one [used in the Linux Kernel](9702969978/include/linux/array_size.h (L11))  (without the additional check to reject pointers, as we would need GNU C for that, see e.g. https://stackoverflow.com/a/19455169; not sure if a useful counterpart exists that only relies on C89). Replacement instances were identified via `$ git grep sizeof.*/.*sizeof`.

ACKs for top commit:
  w0xlt:
    ACK 921b9711ea
  real-or-random:
    utACK 921b9711ea

Tree-SHA512: 44b6bf0132cf00fade526a3fc04e03dc896d04874123614c032206b61f97c81f94d139b6cc0c108eceaa699251580c19420d230b3150607303ca2cb7ab9a0bcb
2026-03-03 15:31:46 +01:00
Sebastian Falbesoner
921b9711ea util: introduce and use ARRAY_SIZE macro
The macro definition matches the one used in Linux, see e.g.
9702969978/include/linux/array_size.h (L11)
(without the additional check rejecting pointers, as we would need
 GNU C for that, see e.g. https://stackoverflow.com/a/19455169)
2026-02-17 00:21:58 +01:00
kevkevinpal
c49c9be504 bench: Update help functions in bench and bench_internal
In the bench and bench_internal help functions argv was not being
passed, in this change we pass in argv[0] and use it in the help text.

Additionally instead of passing all of argv in bench_ecmult we now
just pass argv[0] and is used as the executable_path variable.
2026-02-09 19:17:14 -05:00
kevkevinpal
c09215f7af bench: fail early if user inputs invalid value for SECP256K1_BENCH_ITERS
In this change the get_iters function was updated to print an error
message and then return 0. In the functions that use get_iters they
print the help text and then EXIT_FAILURE
2026-01-23 08:07:22 -05:00
kevkevinpal
3b5b03f301 doc/bench: Added cmake build options to bench error messages 2025-12-05 09:25:23 -05:00
Jonas Nick
6b3fe51fb6 bench: add ellswift to bench help output 2025-03-13 14:51:17 +00:00
Sebastian Falbesoner
c855581728 test, bench, precompute_ecmult: use EXIT_... constants for main return values 2025-02-14 18:03:36 +01:00
Pieter Wuille
1bcea8c57f Add benchmarks for ellswift module 2023-06-20 11:31:58 -04:00
Pieter Wuille
a597a5a9ce Add benchmark for key generation 2023-06-20 10:57:19 -04:00
Pieter Wuille
2e65f1fdbc Avoid using bench_verify_data as bench_sign_data; merge them 2023-05-09 14:00:43 -04:00
Pieter Wuille
e03ef86559 Make all non-API functions (except main) static 2023-01-09 12:02:27 -05:00
Jonas Nick
8d7a9a8eda benchmarks: Switch to NONE contexts 2022-12-07 10:54:43 +00:00
siv2r
dcbe84b841 bench: add --help option to bench.
The following functions were created:
    1. bench.c: help()
        - prints the help to the command-line
    2. bench.h: have_invalid_args()
        - takes a list of arguments that the user is allowed to enter on the command-line
        - returns 1 if the user entered an invalid argument
        - returns 0 if all the user entered arguments are valid
2021-12-04 22:47:30 +05:30
Pieter Wuille
af6abcb3d0 Make bench support selecting which benchmarks to run 2021-11-05 17:48:18 -04:00
Pieter Wuille
9f56bdf5b9 Merge bench_schnorrsig into bench 2021-11-05 17:35:11 -04:00
Pieter Wuille
3208557ae1 Merge bench_recover into bench 2021-11-05 17:34:46 -04:00
Pieter Wuille
855e18d8a8 Merge bench_ecdh into bench 2021-11-05 17:34:25 -04:00
Pieter Wuille
2a7be678a6 Combine bench_sign and bench_verify into single bench 2021-11-05 17:30:56 -04:00
Pieter Wuille
504c63d72a Rename bench to bench_verify 2014-10-31 03:34:36 -07:00
Pieter Wuille
01097ddf19 Make bench deterministic 2014-10-31 03:34:36 -07:00
Pieter Wuille
bae6a42be4 Make bench use external interface 2014-09-29 08:21:59 +02:00
Pieter Wuille
11ab562203 Move implementations from impl/*.h to *_impl.h 2014-03-12 18:40:02 +01:00
Pieter Wuille
764332d05d Make pubkeys, set_xo, ... ge instead of gej 2013-05-05 01:18:23 +02:00
Pieter Wuille
7823916781 Add signing to public interface 2013-05-05 00:21:03 +02:00
Pieter Wuille
d06e61cbb5 Builtin random 2013-04-20 23:57:20 +02:00
Pieter Wuille
7a4b7691b6 Reorganize source tree: no .c for non-objects 2013-04-05 02:09:37 +02:00
Pieter Wuille
eb0be8eec6 Final step in converting to C 2013-04-01 07:52:58 +02:00