summaryrefslogtreecommitdiffhomepage
path: root/dev/Boot/src/BootString.cc
diff options
context:
space:
mode:
authorAmlal <amlal.elmahrouss@icloud.com>2025-01-24 10:38:36 +0100
committerAmlal <amlal.elmahrouss@icloud.com>2025-01-24 10:38:36 +0100
commit7b4bd3577a31d0f0adc7371840642791ae1567f4 (patch)
tree1a8afc973aaa739d0d763315cad2fd376d1cea9c /dev/Boot/src/BootString.cc
ADD: Open version, with important changes kept out.
Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Boot/src/BootString.cc')
-rw-r--r--dev/Boot/src/BootString.cc92
1 files changed, 92 insertions, 0 deletions
diff --git a/dev/Boot/src/BootString.cc b/dev/Boot/src/BootString.cc
new file mode 100644
index 00000000..afd95790
--- /dev/null
+++ b/dev/Boot/src/BootString.cc
@@ -0,0 +1,92 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved.
+
+ File: BootString.cc
+ Purpose: BootZ string library
+
+ Revision History:
+
+
+
+------------------------------------------- */
+
+#include <BootKit/Platform.h>
+#include <BootKit/Protocol.h>
+#include <BootKit/BootKit.h>
+
+/// BUGS: 0
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+Kernel::SizeT Boot::BCopyMem(CharacterTypeUTF16* dest, CharacterTypeUTF16* src, const Kernel::SizeT len)
+{
+ if (!dest || !src)
+ return 0;
+
+ SizeT index = 0UL;
+ for (; index < len; ++index)
+ {
+ dest[index] = src[index];
+ }
+
+ return index;
+}
+
+Kernel::SizeT Boot::BStrLen(const CharacterTypeUTF16* ptr)
+{
+ if (!ptr)
+ return 0;
+
+ Kernel::SizeT cnt = 0;
+
+ while (*ptr != (CharacterTypeUTF16)0)
+ {
+ ++ptr;
+ ++cnt;
+ }
+
+ return cnt;
+}
+
+Kernel::SizeT Boot::BSetMem(CharacterTypeUTF16* src, const CharacterTypeUTF16 byte, const Kernel::SizeT len)
+{
+ if (!src)
+ return 0;
+
+ Kernel::SizeT cnt = 0UL;
+
+ while (*src != 0)
+ {
+ if (cnt > len)
+ break;
+
+ *src = byte;
+ ++src;
+
+ ++cnt;
+ }
+
+ return cnt;
+}
+
+Kernel::SizeT Boot::BSetMem(CharacterTypeUTF8* src, const CharacterTypeUTF8 byte, const Kernel::SizeT len)
+{
+ if (!src)
+ return 0;
+
+ Kernel::SizeT cnt = 0UL;
+
+ while (*src != 0)
+ {
+ if (cnt > len)
+ break;
+
+ *src = byte;
+ ++src;
+
+ ++cnt;
+ }
+
+ return cnt;
+}