From a57529d7b0bd837ffcf28389558df8a408eec6b6 Mon Sep 17 00:00:00 2001 From: "raffaele.gaetano" Date: Mon, 6 Nov 2017 16:50:12 +0100 Subject: [PATCH] FIX: platform check for int64 type, will be __int64 for WIN32, long unsigned int otherwise --- include/grmGraphOperations.txx | 4 ++-- include/grmNeighborhood.h | 10 ++++++++-- src/grmNeighborhood.cxx | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/grmGraphOperations.txx b/include/grmGraphOperations.txx index 777ce6d..8044652 100644 --- a/include/grmGraphOperations.txx +++ b/include/grmGraphOperations.txx @@ -39,7 +39,7 @@ namespace grm { for(auto& r : seg.m_Graph.m_Nodes) { - __int64 neighborhood[4]; + NeighIDType neighborhood[4]; FOURNeighborhood(neighborhood, r->m_Id, width, height); for(short j = 0; j < 4; ++j) { @@ -53,7 +53,7 @@ namespace grm { for(auto& r : seg.m_Graph.m_Nodes) { - __int64 neighborhood[8]; + NeighIDType neighborhood[8]; EIGHTNeighborhood(neighborhood, r->m_Id, width, height); bool haveNeighbors = false; for(short j = 0; j < 8; ++j) diff --git a/include/grmNeighborhood.h b/include/grmNeighborhood.h index bb6e58d..ae7c44e 100644 --- a/include/grmNeighborhood.h +++ b/include/grmNeighborhood.h @@ -20,16 +20,22 @@ #include +#if defined(_WIN32) +typedef __int64 NeighIDType; +#else +typedef long unsigned int NeighIDType; +#endif + enum CONNECTIVITY{FOUR = 0, EIGHT}; namespace grm { - void FOURNeighborhood(__int64 * neighborhood, + void FOURNeighborhood(NeighIDType * neighborhood, const std::size_t id, const unsigned int width, const unsigned int height); - void EIGHTNeighborhood(__int64 * neighborhood, + void EIGHTNeighborhood(NeighIDType * neighborhood, const std::size_t id, const unsigned int width, const unsigned int height); diff --git a/src/grmNeighborhood.cxx b/src/grmNeighborhood.cxx index 19e7593..28238a2 100644 --- a/src/grmNeighborhood.cxx +++ b/src/grmNeighborhood.cxx @@ -19,7 +19,7 @@ namespace grm { - void FOURNeighborhood(__int64 * neighborhood, + void FOURNeighborhood(NeighIDType * neighborhood, const std::size_t id, const unsigned int width, const unsigned int height) @@ -40,7 +40,7 @@ namespace grm neighborhood[3] = ( x > 0 ? (id - 1) : -1 ); } - void EIGHTNeighborhood(__int64 * neighborhood, + void EIGHTNeighborhood(NeighIDType * neighborhood, const std::size_t id, const unsigned int width, const unsigned int height) -- GitLab