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

Barrett todecimal #331

Closed

Conversation

MasterDuke17
Copy link
Collaborator

#330, but rebased onto feature-detection2 so mp_todecimal can be converted into a function that uses MP_HAS to selectively use the new s_mp_todecimal_fast.

that uses Barrett reduction to speed up stringifying large integers.
buffer like `mp_toradix` does.
@MasterDuke17 MasterDuke17 force-pushed the barrett_todecimal branch 4 times, most recently from c6b9503 to 69d57ff Compare August 31, 2019 16:26
that uses MP_HAS to decide whether to use `mp_toradix` or
`s_mp_todecimal_fast`.
@MasterDuke17
Copy link
Collaborator Author

@minad @czurnieden @sjaeckel how does this look? I'm in the process of adding tests, but I'm not sure about documentation. How much is needed and where does it go?

@minad
Copy link
Member

minad commented Sep 1, 2019

Looks good! The CI should be green and we need tests. You can test against mp_toradix for random numbers.

@MasterDuke17
Copy link
Collaborator Author

@minad The two problems in travis are the same, but I'm not exactly sure how to fix them.

bn_s_mp_todecimal_fast.c:16:28: warning: implicitly declaring library function 'snprintf' with type 'int (char *, unsigned long, const char *, ...)' [-Wimplicit-function-declaration]

      int new_pos = left ? snprintf(*result, 4, "%u", mp_get_i32(number)) : snprintf(*result, 4, "%03u",

                           ^

bn_s_mp_todecimal_fast.c:16:28: note: include the header <stdio.h> or explicitly provide a declaration for 'snprintf'

However, stdio.h is already included. Some googling suggests other people have seem similar problems and it's some weird thing about different versions of header files. Do you have any suggestions?

@minad
Copy link
Member

minad commented Sep 1, 2019

Snprintf should not be used.

@sjaeckel
Copy link
Member

sjaeckel commented Sep 2, 2019

closed again in favor of #330

@sjaeckel sjaeckel closed this Sep 2, 2019
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.

3 participants