-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix Chile holidays #2003
Fix Chile holidays #2003
Conversation
* Day of Aboriginal People is on the day of the Winter Solstice, which is not always June 21th. (Except for 2021, when it was on June 21th even though the solstice was on the 20th.) * Add 2022-09-16, which was a day in lieu of Independence Day. * Add 2018-01-16, which was a regional holiday for the Papal visit. * Add 2017-04-19, which was a Census Day.
c5bd1ae
to
fce2ead
Compare
@@ -197,7 +197,7 @@ namespace QuantLib { | |||
} | |||
|
|||
Day Calendar::WesternImpl::easterMonday(Year y) { | |||
static const Day EasterMonday[] = { | |||
static const unsigned char EasterMonday[] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reason for this? The method returns a Day
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The values all fit in a byte, so this saves space in the table. 3 bytes per entry, so about 1800 bytes for the two tables.
I thought it's a bit wasteful to store all these zeros in the data segment, but I can revert back if you think it's not worth it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My doubt is whether this forces a conversion from unsigned char to int each time the method returns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conversion just gets folded into the mov instruction (movzx
instead of plain mov
): https://godbolt.org/z/5bf3PMaGE
They are the same speed when everything is in cache, but with the smaller tables the probability of being in cache is higher.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, thanks.
Day of Aboriginal People is on the day of the Winter Solstice, which is not always June 21th. (Except for 2021, when it was on June 21th even though the solstice was on the 20th.)
Add 2022-09-16, which was a day in lieu of Independence Day.
Add 2018-01-16, which was a regional holiday for the Papal visit.
Add 2017-04-19, which was a Census Day.