Skip to content

Commit 7f492c5

Browse files
committed
feat(ceil-quotient): add ceil_quotient overload
1 parent 5b83bc9 commit 7f492c5

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ include(cmake/Utils.cmake)
77
#
88
project(
99
stdsharp
10-
VERSION 0.6.3
10+
VERSION 0.6.4
1111
LANGUAGES CXX)
1212

1313
config_lib(${PROJECT_NAME} INTERFACE STD 23)

include/stdsharp/cmath/cmath.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
#pragma once
22

33
#include <cmath>
4-
#include <concepts>
4+
5+
#include "../concepts/concepts.h"
56

67
namespace stdsharp
78
{
8-
constexpr auto ceil_reminder(const std::integral auto x, decltype(x) y) noexcept
9+
constexpr auto ceil_quotient(const std::integral auto x, decltype(x) y) noexcept
910
{
1011
return (x + y - 1) / y;
1112
}
13+
14+
constexpr auto ceil_quotient(const floating_point auto x, decltype(x) y) noexcept
15+
{
16+
return ceil(x / y);
17+
}
1218
}

include/stdsharp/memory/static_allocator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ namespace stdsharp
6666

6767
static constexpr auto to_generic_size(const std::size_t size_v)
6868
{
69-
return ceil_reminder(size_v * sizeof(T), sizeof(all_aligned));
69+
return ceil_quotient(size_v * sizeof(T), sizeof(all_aligned));
7070
}
7171
};
7272

@@ -75,5 +75,5 @@ namespace stdsharp
7575

7676
template<typename T, std::size_t Size>
7777
using static_allocator_for =
78-
static_allocator<T, ceil_reminder(Size * sizeof(T), sizeof(all_aligned))>;
78+
static_allocator<T, ceil_quotient(Size * sizeof(T), sizeof(all_aligned))>;
7979
}

include/stdsharp/memory/static_memory_resource.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ namespace stdsharp
131131

132132
template<typename T, std::size_t Size>
133133
using static_memory_resource_for =
134-
static_memory_resource<ceil_reminder(Size * sizeof(T), sizeof(all_aligned))>;
134+
static_memory_resource<ceil_quotient(Size * sizeof(T), sizeof(all_aligned))>;
135135

136136
template<std::size_t Size>
137137
constexpr auto& get_static_memory_resource() noexcept

0 commit comments

Comments
 (0)