00001 #ifndef LM_BUILDER_DISCOUNT_H
00002 #define LM_BUILDER_DISCOUNT_H
00003
00004 #include <algorithm>
00005
00006 #include <stdint.h>
00007
00008 namespace lm {
00009 namespace builder {
00010
00011 struct Discount {
00012 float amount[4];
00013
00014 float Get(uint64_t count) const {
00015 return amount[std::min<uint64_t>(count, 3)];
00016 }
00017
00018 float Apply(uint64_t count) const {
00019 return static_cast<float>(count) - Get(count);
00020 }
00021 };
00022
00023 }
00024 }
00025
00026 #endif // LM_BUILDER_DISCOUNT_H