0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd::base: Fix lack of constexpr ceil().

This commit is contained in:
Jason Volk 2019-06-23 00:05:32 -06:00
parent 35cff6c498
commit e4a5a755d0

View file

@ -58,7 +58,7 @@ ircd::b64decode_size(const string_view &in)
constexpr size_t
ircd::b64decode_size(const size_t &in)
{
return ceil(in * 0.75);
return (in * 0.75) + 1; //XXX: constexpr ceil()
}
inline size_t
@ -70,7 +70,7 @@ ircd::b64encode_unpadded_size(const const_buffer &in)
constexpr size_t
ircd::b64encode_unpadded_size(const size_t &in)
{
return ceil(in * (4.0 / 3.0));
return (in * (4.0 / 3.0)) + 1; //XXX: constexpr ceil()
}
inline size_t
@ -82,7 +82,7 @@ ircd::b64encode_size(const const_buffer &in)
constexpr size_t
ircd::b64encode_size(const size_t &in)
{
return ceil(in * (4.0 / 3.0)) + (3 - in % 3) % 3;
return ((in * (4.0 / 3.0)) + 1) + (3 - in % 3) % 3; //XXX: constexpr ceil
}
inline size_t