Commit 9d3f49f3 authored by aligungr's avatar aligungr

Support for 32-bit architectures

parent aa2b1693
......@@ -8,9 +8,12 @@
#include "ngap.hpp"
#include "utils.hpp"
#include "utils/common.hpp"
#include <algorithm>
#include <functional>
#include <exception>
#include <stdexcept>
#include <asn/ngap/ASN_NGAP_AMFConfigurationUpdate.h>
#include <asn/ngap/ASN_NGAP_AMFConfigurationUpdateAcknowledge.h>
......@@ -858,9 +861,8 @@ static bool GetProtocolIeInfo(const ASN_NGAP_NGAP_PDU &pdu, const asn_TYPE_descr
// Therefore no problem is expected since the structs are already standard layout.
// Assert that the machine is Little Endian. (This assumption is used for presentEnumSize and related)
#if 'ABCD' != 0x41424344
#error "Big Endian architecture is not supported"
#endif
if (!utils::IsLittleEndian())
throw std::runtime_error("Big Endian architecture is not supported");
asn_TYPE_descriptor_t *desc;
void *ptr;
......
......@@ -18,6 +18,7 @@
#include <stdexcept>
#include <thread>
#include <arpa/inet.h>
#include <unistd.h>
static_assert(sizeof(char) == sizeof(uint8_t));
......@@ -324,3 +325,8 @@ void utils::Trim(std::stringstream &s)
Trim(str);
s.str(str);
}
bool utils::IsLittleEndian()
{
return htonl(1453) != 1453;
}
......@@ -40,6 +40,7 @@ bool IsNumeric(const std::string &str);
void AssertNodeName(const std::string &str);
void Trim(std::string &str);
void Trim(std::stringstream &str);
bool IsLittleEndian();
template <typename T>
inline void ClearAndDelete(std::vector<T *> &vector)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment