From 1a86735a37fe69dce742be0457ea2c89e8a0ee86 Mon Sep 17 00:00:00 2001 From: mertcandav Date: Thu, 14 Mar 2024 02:45:38 +0300 Subject: [PATCH] api: minor optimizations --- api/builtin.hpp | 2 +- api/slice.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/builtin.hpp b/api/builtin.hpp index d301313e2..236f4662d 100644 --- a/api/builtin.hpp +++ b/api/builtin.hpp @@ -67,7 +67,7 @@ namespace jule { if (dest._len + n > dest._cap) { - const jule::Int alloc_size = (dest._len + n) * 2; + const jule::Int alloc_size = (dest._len + n) << 1; jule::Slice buffer = jule::Slice::alloc(0, alloc_size); buffer._len = dest._len; std::move( diff --git a/api/slice.hpp b/api/slice.hpp index 5003291a1..f04976afa 100644 --- a/api/slice.hpp +++ b/api/slice.hpp @@ -322,7 +322,7 @@ namespace jule if (this->_len == this->_cap) { jule::Slice _new; - _new.alloc_new(this->_len + 1, (this->_len + 1) * 2); + _new.alloc_new(this->_len + 1, (this->_len + 1) << 1); std::move( this->_slice, this->_slice + this->_len,