-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Generate instead of hard coding factorial tables #22096
Conversation
How so? |
big number constant literals might be incorrect; it takes some work to verify. of course I think the original literals have been verified already, but there isn't any harm in doing this. |
what's more likely to sneak through without tests noticing, the literals being wrong (or mis-parsed?) or something screwy happening to the generation code like an accidental overflow due to some other problem? |
Any test that detects the literal being wrong will certainly also detect the generation code that generates its equivalent being wrong. |
Also, it is easier for a human to detect an error in the generation code than to detect an error in the literal. |
Probably, and it's a bit shorter. We might want to preallocate them to the right size, to avoid a few bytes of overallocation that'll never be needed. |
Maybe the existing literal tables could be used as part of the tests for the generated values? |
How about the other way around - Why not leave the literal tables here, and instead have the code verify the tables in the tests? Does this have any noticeable impact on startup time (just asking)? |
This would happen at sysimg time, so any time impact would only be there. This shouldn't take any noticeable amount of time though. |
I've addressed the comments of @tkelman and @GregPlowman. |
This should be less prone to bugs.