diff options
| author | Amlal <amlalelmahrouss@icloud.com> | 2024-12-21 21:59:13 +0100 |
|---|---|---|
| committer | Amlal <amlalelmahrouss@icloud.com> | 2024-12-21 21:59:45 +0100 |
| commit | 610f91d87152cbe48d3054fcf437d8239da6ef35 (patch) | |
| tree | a386f7047ab73d088169ab2371ddc6ffe8020f1c /dev/BootLoader/src/BootString.cc | |
| parent | 509fcca5986651c8ba712fb395f8498f2dea4109 (diff) | |
IMP: :boom: Breaking changes some checks are needed to be done.
Signed-off-by: Amlal <amlalelmahrouss@icloud.com>
Diffstat (limited to 'dev/BootLoader/src/BootString.cc')
| -rw-r--r-- | dev/BootLoader/src/BootString.cc | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/dev/BootLoader/src/BootString.cc b/dev/BootLoader/src/BootString.cc new file mode 100644 index 00000000..6ea95173 --- /dev/null +++ b/dev/BootLoader/src/BootString.cc @@ -0,0 +1,92 @@ +/* ------------------------------------------- + + Copyright (C) 2024, TQ B.V, 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; +} |
