Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions include/ada/common_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,40 +185,6 @@ namespace ada {
#define ada_constexpr constexpr
#endif

#if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
#define ADA_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#elif defined(_WIN32)
#define ADA_IS_BIG_ENDIAN 0
#else
#if defined(__APPLE__) || \
defined(__FreeBSD__) // defined __BYTE_ORDER__ && defined
// __ORDER_BIG_ENDIAN__
#include <machine/endian.h>
#elif defined(sun) || \
defined(__sun) // defined(__APPLE__) || defined(__FreeBSD__)
#include <sys/byteorder.h>
#else // defined(__APPLE__) || defined(__FreeBSD__)

#ifdef __has_include
#if __has_include(<endian.h>)
#include <endian.h>
#endif //__has_include(<endian.h>)
#endif //__has_include

#endif // defined(__APPLE__) || defined(__FreeBSD__)

#ifndef !defined(__BYTE_ORDER__) || !defined(__ORDER_LITTLE_ENDIAN__)
#define ADA_IS_BIG_ENDIAN 0
#endif

#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define ADA_IS_BIG_ENDIAN 0
#else // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define ADA_IS_BIG_ENDIAN 1
#endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__

#endif // defined __BYTE_ORDER__ && defined __ORDER_BIG_ENDIAN__

// Unless the programmer has already set ADA_DEVELOPMENT_CHECKS,
// we want to set it under debug builds. We detect a debug build
// under Visual Studio when the _DEBUG macro is set. Under the other
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "ada.h"
#include "ada/checkers-inl.h"
#include "ada/common_defs.h" // make sure ADA_IS_BIG_ENDIAN gets defined.
#include "ada/common_defs.h"
#include "ada/scheme.h"

#include <cstring>
Expand Down
11 changes: 6 additions & 5 deletions tests/basic_fuzzer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "ada.h"
#include <iostream>
#include <memory>
#include <bit>

std::string url_examples[] = {
"https://www.google.com/"
Expand Down Expand Up @@ -118,11 +119,11 @@ size_t roller_fuzz(size_t N) {
}

int main() {
#if ADA_IS_BIG_ENDIAN
std::cout << "You have big-endian system." << std::endl;
#else
std::cout << "You have litte-endian system." << std::endl;
#endif
if (std::endian::native == std::endian::big) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that it matters/changes anything

Suggested change
if (std::endian::native == std::endian::big) {
if constexpr (std::endian::native == std::endian::big) {

std::cout << "You have big-endian system." << std::endl;
} else {
std::cout << "You have litte-endian system." << std::endl;
}
std::cout << "Running basic fuzzer.\n";
std::cout << "[fancy] Executed " << fancy_fuzz<ada::url>(100000)
<< " mutations.\n";
Expand Down