diff options
Diffstat (limited to 'Private/NewBoot/Source/BootString.cxx')
| -rw-r--r-- | Private/NewBoot/Source/BootString.cxx | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Private/NewBoot/Source/BootString.cxx b/Private/NewBoot/Source/BootString.cxx new file mode 100644 index 00000000..9fbe1a11 --- /dev/null +++ b/Private/NewBoot/Source/BootString.cxx @@ -0,0 +1,61 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + + File: String.cxx + Purpose: NewBoot string library + + Revision History: + + + +------------------------------------------- */ + +#include <BootKit/BootKit.hxx> + +/// bugs 0 + +///////////////////////////////////////////////////////////////////////////////////////////////////////// + +HCore::SizeT BCopyMem(CharacterType *dest, CharacterType *src, + const HCore::SizeT len) { + if (!dest || !src) return 0; + + SizeT index = 0UL; + for (; index < len; ++index) { + dest[index] = src[index]; + } + + return index; +} + +HCore::SizeT BStrLen(const CharacterType *ptr) { + if (!ptr) return 0; + + HCore::SizeT cnt = 0; + + while (*ptr != (CharacterType)0) { + ++ptr; + ++cnt; + } + + return cnt; +} + +HCore::SizeT BSetMem(CharacterType *src, const CharacterType byte, + const HCore::SizeT len) { + if (!src) return 0; + + HCore::SizeT cnt = 0UL; + + while (*src != 0) { + if (cnt > len) break; + + *src = byte; + ++src; + + ++cnt; + } + + return cnt; +} |
