summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/GenericsLibrary/algorithm.nhh34
-rw-r--r--include/GenericsLibrary/fstream.nhh2
-rw-r--r--include/GenericsLibrary/iterator.nhh2
-rw-r--r--include/GenericsLibrary/math.nhh84
-rw-r--r--include/GenericsLibrary/swap.nhh20
-rw-r--r--include/ThirdParty/.keep0
6 files changed, 140 insertions, 2 deletions
diff --git a/include/GenericsLibrary/algorithm.nhh b/include/GenericsLibrary/algorithm.nhh
new file mode 100644
index 0000000..b62faa1
--- /dev/null
+++ b/include/GenericsLibrary/algorithm.nhh
@@ -0,0 +1,34 @@
+// 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/nekernel-org/nectar
+
+#ifndef NECTAR_GL_ALGORITHM_NHH
+#define NECTAR_GL_ALGORITHM_NHH
+
+//@ Free algorithm functions for GenericsLibrary.
+
+let for_each(let iterator_instance, let action)
+{
+ for (let i := iterator_instance.begin(); i < iterator_instance.end(); i += 1)
+ {
+ action(i);
+ }
+
+ return;
+}
+
+let find(let iterator_instance, let predicate)
+{
+ for (let i := iterator_instance.begin(); i < iterator_instance.end(); i += 1)
+ {
+ if (predicate(i))
+ {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+#endif //@ NECTAR_GL_ALGORITHM_NHH \ No newline at end of file
diff --git a/include/GenericsLibrary/fstream.nhh b/include/GenericsLibrary/fstream.nhh
index 19cd935..b7a0a2e 100644
--- a/include/GenericsLibrary/fstream.nhh
+++ b/include/GenericsLibrary/fstream.nhh
@@ -45,4 +45,4 @@ impl fstream : fstream_traits
}
};
-#endif // NECTAR_GL_FSTREAM_NHH \ No newline at end of file
+#endif //@ NECTAR_GL_FSTREAM_NHH \ No newline at end of file
diff --git a/include/GenericsLibrary/iterator.nhh b/include/GenericsLibrary/iterator.nhh
index 0812861..8ff18ff 100644
--- a/include/GenericsLibrary/iterator.nhh
+++ b/include/GenericsLibrary/iterator.nhh
@@ -53,4 +53,4 @@ impl iterator : iterator_traits
}
};
-#endif // NECTAR_GL_ITERATOR_NHH \ No newline at end of file
+#endif //@ NECTAR_GL_ITERATOR_NHH \ No newline at end of file
diff --git a/include/GenericsLibrary/math.nhh b/include/GenericsLibrary/math.nhh
new file mode 100644
index 0000000..c9b66a9
--- /dev/null
+++ b/include/GenericsLibrary/math.nhh
@@ -0,0 +1,84 @@
+// 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/nekernel-org/nectar
+
+#ifndef NECTAR_GL_FUNCTIONS_NHH
+#define NECTAR_GL_FUNCTIONS_NHH
+
+//@ Free math functions for GenericsLibrary.
+
+let min(let a, let b)
+{
+ if (a < b)
+ {
+ return a;
+ }
+ else
+ {
+ return b;
+ }
+}
+
+let max(let a, let b)
+{
+ if (a > b)
+ {
+ return a;
+ }
+ else
+ {
+ return b;
+ }
+}
+
+let abs(let value)
+{
+ if (value < 0)
+ {
+ return -value;
+ }
+ else
+ {
+ return value;
+ }
+}
+
+let clamp(let value, let min_value, let max_value)
+{
+ if (value < min_value)
+ {
+ return min_value;
+ }
+ else if (value > max_value)
+ {
+ return max_value;
+ }
+ else
+ {
+ return value;
+ }
+}
+
+let lerp(let a, let b, let t)
+{
+ return a + t * (b - a);
+}
+
+let sign(let value)
+{
+ if (value > 0)
+ {
+ return 1;
+ }
+ else if (value < 0)
+ {
+ return -1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+#endif //@ NECTAR_GL_FUNCTIONS_NHH \ No newline at end of file
diff --git a/include/GenericsLibrary/swap.nhh b/include/GenericsLibrary/swap.nhh
new file mode 100644
index 0000000..7090535
--- /dev/null
+++ b/include/GenericsLibrary/swap.nhh
@@ -0,0 +1,20 @@
+// 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/nekernel-org/nectar
+
+#ifndef NECTAR_GL_SWAP_NHH
+#define NECTAR_GL_SWAP_NHH
+
+//@ Free swap functions for GenericsLibrary.
+
+let swap(let a, let b)
+{
+ let temp := a;
+ a := b;
+ b := temp;
+
+ return;
+}
+
+#endif //@ NECTAR_GL_SWAP_NHH \ No newline at end of file
diff --git a/include/ThirdParty/.keep b/include/ThirdParty/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/include/ThirdParty/.keep