diff --git a/AK/Bitmap.h b/AK/Bitmap.h index 493abe7d5a..aaaa46e6bc 100644 --- a/AK/Bitmap.h +++ b/AK/Bitmap.h @@ -112,7 +112,7 @@ public: fill(default_value); if (previous_data != nullptr) { - memcpy(m_data, previous_data, previous_size_bytes); + __builtin_memcpy(m_data, previous_data, previous_size_bytes); if ((previous_size % 8) != 0) { if (default_value) @@ -127,7 +127,7 @@ public: void fill(bool value) { - memset(m_data, value ? 0xff : 0x00, size_in_bytes()); + __builtin_memset(m_data, value ? 0xff : 0x00, size_in_bytes()); } Optional find_first_set() const diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index 23684f9820..179cba936c 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -213,7 +213,7 @@ public: { int old_size = size(); grow(size() + data_size); - memcpy(this->data() + old_size, data, data_size); + __builtin_memcpy(this->data() + old_size, data, data_size); } private: @@ -237,7 +237,7 @@ inline ByteBufferImpl::ByteBufferImpl(const void* data, size_t size, Constructio { ASSERT(mode == Copy); m_data = static_cast(kmalloc(size)); - memcpy(m_data, data, size); + __builtin_memcpy(m_data, data, size); m_owned = true; } @@ -257,7 +257,7 @@ inline void ByteBufferImpl::grow(size_t size) ASSERT(size > m_size); ASSERT(m_owned); u8* new_data = static_cast(kmalloc(size)); - memcpy(new_data, m_data, m_size); + __builtin_memcpy(new_data, m_data, m_size); u8* old_data = m_data; m_data = new_data; m_size = size; @@ -272,7 +272,7 @@ inline NonnullRefPtr ByteBufferImpl::create_uninitialized(size_t inline NonnullRefPtr ByteBufferImpl::create_zeroed(size_t size) { auto buffer = ::adopt(*new ByteBufferImpl(size)); - memset(buffer->data(), 0, size); + __builtin_memset(buffer->data(), 0, size); return buffer; } diff --git a/AK/Optional.h b/AK/Optional.h index c135440013..7686bfdd5d 100644 --- a/AK/Optional.h +++ b/AK/Optional.h @@ -157,7 +157,7 @@ private: ASSERT(m_has_value); return *reinterpret_cast(&m_storage); } - u8 m_storage[sizeof(T)] { 0 }; + unsigned char m_storage[sizeof(T)] { 0 }; bool m_has_value { false }; }; diff --git a/AK/String.h b/AK/String.h index d1851fabf0..0158adb223 100644 --- a/AK/String.h +++ b/AK/String.h @@ -177,7 +177,7 @@ public: return !cstring; if (!cstring) return false; - return !strcmp(characters(), cstring); + return !__builtin_strcmp(characters(), cstring); } bool operator!=(const char* cstring) const @@ -273,7 +273,7 @@ inline bool operator<(const char* characters, const String& string) if (string.is_null()) return false; - return strcmp(characters, string.characters()) < 0; + return __builtin_strcmp(characters, string.characters()) < 0; } inline bool operator>=(const char* characters, const String& string) @@ -289,7 +289,7 @@ inline bool operator>(const char* characters, const String& string) if (string.is_null()) return false; - return strcmp(characters, string.characters()) > 0; + return __builtin_strcmp(characters, string.characters()) > 0; } inline bool operator<=(const char* characters, const String& string) diff --git a/AK/Vector.h b/AK/Vector.h index 8512d3014a..735d45e157 100644 --- a/AK/Vector.h +++ b/AK/Vector.h @@ -96,7 +96,7 @@ public: if (!count) return; if constexpr (Traits::is_trivial()) { - memmove(destination, source, count * sizeof(T)); + __builtin_memmove(destination, source, count * sizeof(T)); return; } for (size_t i = 0; i < count; ++i) @@ -108,7 +108,7 @@ public: if (!count) return; if constexpr (Traits::is_trivial()) { - memmove(destination, source, count * sizeof(T)); + __builtin_memmove(destination, source, count * sizeof(T)); return; } for (size_t i = 0; i < count; ++i) @@ -121,7 +121,7 @@ public: return true; if constexpr (Traits::is_trivial()) - return !memcmp(a, b, count * sizeof(T)); + return !__builtin_memcmp(a, b, count * sizeof(T)); for (size_t i = 0; i < count; ++i) { if (a[i] != b[i]) @@ -641,7 +641,7 @@ private: size_t m_size { 0 }; size_t m_capacity { 0 }; - alignas(T) u8 m_inline_buffer_storage[sizeof(T) * inline_capacity]; + alignas(T) unsigned char m_inline_buffer_storage[sizeof(T) * inline_capacity]; T* m_outline_buffer { nullptr }; };