Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Release 1.0.4

See merge request ii887522/nitro!47
  • Loading branch information
ii887522 committed May 13, 2021
2 parents a499d28 + adf86ee commit 920474d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
16 changes: 14 additions & 2 deletions nitro/src/main/Allocator/linear_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ enum class Term : unsigned int {
LONG, SHORT
};

#ifdef ALLOCATOR_IMPLEMENTATIONS
static char longTermData[LONG_TERM_ALLOCATOR_SIZE];
static size_t longTermDataSize{ 0u };
#ifdef SHORT_TERM_ALLOCATOR_SIZE
static char shortTermData[SHORT_TERM_ALLOCATOR_SIZE];
static size_t shortTermDataSize{ 0u };
#endif
static Term term{ Term::LONG };
#endif

constexpr static size_t getAlignedDataSize(const size_t dataSize, const size_t size) {
const auto alignmentRequirement{ min(size, alignof(max_align_t)) };
Expand Down Expand Up @@ -67,14 +69,24 @@ static void* shortTermAlloc(const size_t size) {
#endif

#ifdef SHORT_TERM_ALLOCATOR_SIZE
constexpr void beginShortTermAlloc() {
void beginShortTermAlloc()
#ifdef ALLOCATOR_IMPLEMENTATIONS
{
term = Term::SHORT;
}
#else
; // NOLINT(whitespace/semicolon)
#endif

constexpr void endShortTermAlloc() {
void endShortTermAlloc()
#ifdef ALLOCATOR_IMPLEMENTATIONS
{
shortTermDataSize = 0u;
term = Term::LONG;
}
#else
; // NOLINT(whitespace/semicolon)
#endif
#endif

} // namespace ii887522::nitro
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nitro",
"version": "1.0.3",
"version": "1.0.4",
"description": "It is a general purpose C++ library that can help developers create various kinds of applications in no time.",
"scripts": {
"install": "node build.js"
Expand Down

0 comments on commit 920474d

Please sign in to comment.