Commit e6123720 authored by Jack Andersen's avatar Jack Andersen

Better CMake dependency handling

parent 9dd968dd
......@@ -10,14 +10,13 @@ elseif(UNIX AND NOT APPLE)
set(JBUS_PLAT_LIBS pthread)
endif()
include_directories(include)
add_library(jbus
include/jbus/optional.hpp
lib/Socket.cpp include/jbus/Socket.hpp
lib/Common.cpp include/jbus/Common.hpp
lib/Endpoint.cpp include/jbus/Endpoint.hpp
lib/Listener.cpp include/jbus/Listener.hpp)
target_link_libraries(jbus ${JBUS_PLAT_LIBS})
target_include_directories(jbus PUBLIC include)
add_executable(joyboot tools/joyboot.cpp)
target_link_libraries(joyboot jbus)
......@@ -67,13 +67,15 @@ static inline int32_t SBig(int32_t val) { return bswap32(val); }
static inline uint32_t SBig(uint32_t val) { return bswap32(val); }
static inline int64_t SBig(int64_t val) { return bswap64(val); }
static inline uint64_t SBig(uint64_t val) { return bswap64(val); }
static inline float SBig(float val) {
int32_t ival = bswap32(*((int32_t*)(&val)));
return *((float*)(&ival));
inline float SBig(float val) {
union { float f; int32_t i; } uval1 = {val};
union { int32_t i; float f; } uval2 = {bswap32(uval1.i)};
return uval2.f;
}
static inline double SBig(double val) {
int64_t ival = bswap64(*((int64_t*)(&val)));
return *((double*)(&ival));
inline double SBig(double val) {
union { double f; int64_t i; } uval1 = {val};
union { int64_t i; double f; } uval2 = {bswap64(uval1.i)};
return uval2.f;
}
#ifndef SBIG
#define SBIG(q) (((q)&0x000000FF) << 24 | ((q)&0x0000FF00) << 8 | ((q)&0x00FF0000) >> 8 | ((q)&0xFF000000) >> 24)
......
This diff is collapsed.
......@@ -91,7 +91,7 @@ int main(int argc, char** argv) {
}
jbus::s64 curTime = jbus::GetGCTicks();
jbus::s64 passedTicks = curTime - start;
if (passedTicks > jbus::GetGCTicksPerSec() * 10) {
if (passedTicks > jbus::s64(jbus::GetGCTicksPerSec()) * 10) {
fprintf(stderr, "JoyBoot timeout\n");
return 1;
}
......@@ -102,7 +102,7 @@ int main(int argc, char** argv) {
while (!DonePoll(*endpoint)) {
jbus::s64 curTime = jbus::GetGCTicks();
jbus::s64 passedTicks = curTime - start;
if (passedTicks > jbus::GetGCTicksPerSec() * 15) {
if (passedTicks > jbus::s64(jbus::GetGCTicksPerSec()) * 15) {
fprintf(stderr, "JoyBoot timeout\n");
return 1;
}
......
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