Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failed test SimpleTwoRegionNetworkIntrospection on 32 bit Linux #1438

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion src/nupic/bindings/engine_internal.i
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ class IterablePair(object):


//32bit fix - Already seen by swig on linux32 where size_t is the same size as unsigned int
#if !(defined(NTA_ARCH_32) && defined(NTA_OS_LINUX))
#if (defined(NTA_ARCH_32) && defined(NTA_OS_LINUX))
%template(Dimset) std::vector<unsigned long>;
#else
%template(Dimset) std::vector<size_t>;
#endif

Expand Down
12 changes: 12 additions & 0 deletions src/nupic/ntypes/Dimensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,25 @@
#include <nupic/utils/Log.hpp>
#include <utility>

#if (defined(NTA_ARCH_32) && defined(NTA_OS_LINUX))
#include <climits>
#endif

using namespace nupic;

Dimensions::Dimensions(){};

Dimensions::Dimensions(std::vector<size_t> v)
: std::vector<size_t>(std::move(v)){};

#if (defined(NTA_ARCH_32) && defined(NTA_OS_LINUX))
Dimensions::Dimensions(std::vector<unsigned long> v) {
for (size_t i = 0; i < v.size(); i++) {
push_back(v[i] & UINT_MAX);
}
}
#endif

Dimensions::Dimensions(size_t x) { push_back(x); }

Dimensions::Dimensions(size_t x, size_t y) {
Expand Down
14 changes: 13 additions & 1 deletion src/nupic/ntypes/Dimensions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,20 @@ class Dimensions : public std::vector<size_t> {
*/
Dimensions(std::vector<size_t> v);

/** Create a new 1-dimension Dimensions object.
#if (defined(NTA_ARCH_32) && defined(NTA_OS_LINUX))
/**
* Create a new Dimensions object from a @c std::vector<unsigned long>.
*
* @param v
* A @c std::vector of @c unsigned long, the value with the index
* of @a n is the size of the @a n th dimension
*
*/
Dimensions(std::vector<unsigned long> v);
#endif

/** Create a new 1-dimension Dimensions object.
*
* @param x
* The size of the 1st dimension
*
Expand Down