From df7ef3ba6105cc414b69f2b0666d50dec7030536 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 11 Mar 2026 06:09:44 +0100 Subject: [CHORE] Update GenericsLibrary include library. Signed-off-by: Amlal El Mahrouss --- include/GenericsLibrary/std.nhh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 include/GenericsLibrary/std.nhh (limited to 'include/GenericsLibrary/std.nhh') diff --git a/include/GenericsLibrary/std.nhh b/include/GenericsLibrary/std.nhh new file mode 100644 index 0000000..e7a351d --- /dev/null +++ b/include/GenericsLibrary/std.nhh @@ -0,0 +1,29 @@ +// Copyright 2026, Amlal El Mahrouss (amlal@nekernel.org) +// Licensed under the Apache License, Version 2.0 (See accompanying +// file LICENSE or copy at http://www.apache.org/licenses/LICENSE-2.0) +// Official repository: https://github.com/ne-foss-org/nectar + +#pragma once + +#define PALLOC_INVALID 0 + +extern __nrt_alloc; +extern __nrt_free; + +//@ Parallel free +let free_bytes(let ptr) +{ + if (ptr := 0) return 0; + return __nrt_free(ptr); +} + +//@ Parallel alloc (bytes) +let alloc_bytes(let type, let sz, let align := 0) +{ + if (0 := align) return 0; + if (0 := type) return 0; + if (0 := sz) return 0; + + return __nrt_alloc(type, sz, align); +} + -- cgit v1.2.3