Skip to content

Commit

Permalink
Fix an off-by-one :)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeaye committed Feb 4, 2024
1 parent cde9a30 commit 1317135
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/cpp/jank/runtime/obj/symbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace jank::runtime
static_object(native_persistent_string &&ns, native_persistent_string &&n);
static_object(native_persistent_string const &ns,
native_persistent_string const &n,
option<object_ptr> meta);
object_ptr meta);

static_object &operator=(static_object const &) = default;
static_object &operator=(static_object &&) = default;
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/jank/codegen/processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ namespace jank::codegen
auto ret_tmp(runtime::context::unique_string("map"));

/* Jump right to a hash map, if we have enough values. */
if(expr.data_exprs.size() < runtime::obj::persistent_array_map::max_size)
if(expr.data_exprs.size() <= runtime::obj::persistent_array_map::max_size)
{
fmt::format_to(inserter, "auto const {}(", ret_tmp);
if(expr.meta.is_some())
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/jank/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ namespace jank::evaluate
analyze::expr::map<analyze::expression> const &expr)
{
auto const size(expr.data_exprs.size());
if(size < runtime::obj::persistent_array_map::max_size)
if(size <= runtime::obj::persistent_array_map::max_size)
{
auto const array_box(make_array_box<runtime::object_ptr>(size * 2));
size_t i{};
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/jank/runtime/obj/symbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace jank::runtime

obj::symbol::static_object(native_persistent_string const &ns,
native_persistent_string const &n,
option<object_ptr> const meta)
object_ptr const meta)
: ns{ ns }
, name{ n }
, meta{ meta }
Expand Down

0 comments on commit 1317135

Please sign in to comment.