2020-08-22 11:10:19 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-08-22 11:10:19 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <AK/ByteBuffer.h>
|
|
|
|
|
|
|
|
|
|
namespace AK {
|
|
|
|
|
|
|
|
|
|
bool ByteBuffer::operator==(const ByteBuffer& other) const
|
|
|
|
|
{
|
|
|
|
|
if (is_empty() != other.is_empty())
|
|
|
|
|
return false;
|
|
|
|
|
if (is_empty())
|
|
|
|
|
return true;
|
|
|
|
|
if (size() != other.size())
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// So they both have data, and the same length.
|
2021-02-21 11:22:41 -03:00
|
|
|
return !__builtin_memcmp(data(), other.data(), size());
|
2020-08-22 11:10:19 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|