summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/src/WideUtils.cc
blob: 0f628e00b1b4bff4d5dba28d1c3cd6908fc774a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* -------------------------------------------

  Copyright (C) 2025, Amlal El Mahrouss, all rights reserved.

------------------------------------------- */

#include <NewKit/Utils.h>

namespace Kernel {
Size wrt_string_len(const Utf16Char* str) {
  SizeT len{0};

  while (str[len] != u'\0') ++len;

  return len;
}

Int wrt_copy_memory(const voidPtr src, voidPtr dst, Size len) {
  Utf16Char* srcChr  = reinterpret_cast<Utf16Char*>(src);
  Utf16Char* dstChar = reinterpret_cast<Utf16Char*>(dst);

  Size index = 0;

  while (index < len) {
    dstChar[index] = srcChr[index];
    ++index;
  }

  dstChar[index] = 0;

  return index;
}
}  // namespace Kernel