Skip to content

Commit 548ef0f

Browse files
authored
Merge pull request #1306 from tobil4sk/fix/optimize-encoding
Optimise new encoding functions
2 parents 95c892f + ae132b9 commit 548ef0f

7 files changed

Lines changed: 697 additions & 661 deletions

File tree

‎include/cpp/encoding/Utf16.hpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ namespace cpp
99
static bool isEncoded(const String& string);
1010

1111
static int getByteCount(const null&);
12-
static int getByteCount(const char32_t& codepoint);
12+
static int getByteCount(char32_t codepoint);
1313
static int64_t getByteCount(const String& string);
1414

1515
static int getCharCount(const null&);
16-
static int getCharCount(const char32_t& codepoint);
16+
static int getCharCount(char32_t codepoint);
1717
static int64_t getCharCount(const String& string);
1818

1919
static int encode(const null&, const cpp::marshal::View<uint8_t>& buffer);
20-
static int encode(const char32_t& codepoint, const cpp::marshal::View<uint8_t>& buffer);
20+
static int encode(char32_t codepoint, const cpp::marshal::View<uint8_t>& buffer);
2121
static int64_t encode(const String& string, const cpp::marshal::View<uint8_t>& buffer);
2222

2323
static char32_t codepoint(const cpp::marshal::View<uint8_t>& buffer);

‎include/cpp/encoding/Utf8.hpp‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ namespace cpp
77
struct Utf8 final
88
{
99
static int getByteCount(const null&);
10-
static int getByteCount(const char32_t& codepoint);
10+
static int getByteCount(char32_t codepoint);
1111
static int64_t getByteCount(const String& string);
1212

1313
static int getCharCount(const null&);
14-
static int getCharCount(const char32_t& codepoint);
14+
static int getCharCount(char32_t codepoint);
1515
static int64_t getCharCount(const String& string);
1616

1717
static int encode(const null&, const cpp::marshal::View<uint8_t>& buffer);
18-
static int encode(const char32_t& codepoint, const cpp::marshal::View<uint8_t>& buffer);
18+
static int encode(char32_t codepoint, const cpp::marshal::View<uint8_t>& buffer);
1919
static int64_t encode(const String& string, const cpp::marshal::View<uint8_t>& buffer);
20+
static Array<uint8_t> encode(const String& string);
2021

2122
static char32_t codepoint(const cpp::marshal::View<uint8_t>& buffer);
2223
static String decode(const cpp::marshal::View<uint8_t>& buffer);

‎src/cpp/encoding/Ascii.cpp‎

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)