diff options
author | Ken Murchison <murch@fastmail.com> | 2019-01-03 11:56:20 -0500 |
---|---|---|
committer | Ken Murchison <murch@fastmail.com> | 2019-01-03 11:56:25 -0500 |
commit | 62a3a7e77125952ecb047dd6a9885ab85be58e29 (patch) | |
tree | 6ee401fc45c6495b6c7cf8a92754f9710304ca23 | |
parent | ad0d195579670fb24a3dda2e6cc792f1ef937ecf (diff) | |
download | libical-git-62a3a7e77125952ecb047dd6a9885ab85be58e29.tar.gz |
icalduration.c: use distributive property to reduce access number of multiplications
-rw-r--r-- | src/libical/icalduration.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libical/icalduration.c b/src/libical/icalduration.c index 01f61b01..9587a8fd 100644 --- a/src/libical/icalduration.c +++ b/src/libical/icalduration.c @@ -267,13 +267,13 @@ char *icaldurationtype_as_ical_string_r(struct icaldurationtype d) return buf; } -/* From Russel Steinthal */ int icaldurationtype_as_int(struct icaldurationtype dur) { return (int)((dur.seconds + - (60 * dur.minutes) + - (60 * 60 * dur.hours) + - (60 * 60 * 24 * dur.days) + (60 * 60 * 24 * 7 * dur.weeks)) + 60 * (dur.minutes + + 60 * (dur.hours + + 24 * (dur.days + + 7 * dur.weeks)))) * (dur.is_neg == 1 ? -1 : 1)); } |