Skip to content

Commit

Permalink
long -> long long (on Windows long is 32 bits!)
Browse files Browse the repository at this point in the history
  • Loading branch information
evgueni-ovtchinnikov committed Feb 27, 2024
1 parent 94fd578 commit 5ec1fac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/xGadgetron/cGadgetron/cgadgetron.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ cGT_ISMRMRDAcquisitionsFromFile(const char* file, int all, size_t ptr)
if (!file_exists(file))
return fileNotFound(file, __FILE__, __LINE__);
try {
auto ptr_ignored = reinterpret_cast<unsigned long int*>(ptr);
auto ptr_ignored = reinterpret_cast<unsigned long long int*>(ptr);
auto ignored = *ptr_ignored;
std::cout << "reading from " << file << " using ignore mask ";
IgnoreMask mask;
Expand Down Expand Up @@ -727,7 +727,7 @@ cGT_setAcquisitionsIgnoreMask(void* ptr_acqs, size_t ptr_im)
objectFromHandle<MRAcquisitionData>(h_acqs);
shared_ptr<ISMRMRD::Acquisition>
sptr_acq(new ISMRMRD::Acquisition);
auto im = *reinterpret_cast<unsigned long int*>(ptr_im);
auto im = *reinterpret_cast<unsigned long long int*>(ptr_im);
acqs.set_ignore_mask(im);
return new DataHandle;
}
Expand All @@ -744,7 +744,7 @@ cGT_acquisitionsIgnoreMask(void* ptr_acqs, size_t ptr_im)
objectFromHandle<MRAcquisitionData>(h_acqs);
shared_ptr<ISMRMRD::Acquisition>
sptr_acq(new ISMRMRD::Acquisition);
auto im = reinterpret_cast<unsigned long int*>(ptr_im);
auto im = reinterpret_cast<unsigned long long int*>(ptr_im);
*im = acqs.ignore_mask().bits();
return new DataHandle;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,46 +131,46 @@ namespace sirf {
*/
class IgnoreMask {
public:
IgnoreMask(unsigned long int mask = (1 << 18)) :
IgnoreMask(unsigned long long int mask = (1 << 18)) :
ignore_(mask), max_(8*sizeof(mask)) {}
void set(unsigned long int mask)
void set(unsigned long long int mask)
{
ignore_ = mask;
}
void ignore(unsigned int i)
{
if (i < 1 || i > max_)
return;
unsigned long int one = 1;
unsigned long long int one = 1;
ignore_ = ignore_ | (one << (i - 1));
}
void ignore_not(unsigned int i)
{
if (i < 1 || i > max_)
return;
unsigned long int one = 1;
unsigned long long int one = 1;
ignore_ = ignore_ & ~(one << (i - 1));
}
bool bit(unsigned int i) const
{
if (i < 1 || i > max_)
return true;
unsigned long int one = 1;
unsigned long long int one = 1;
return ignore_ & (one << (i - 1));
}
unsigned long int bits() const
unsigned long long int bits() const
{
return ignore_;
}
bool ignored(unsigned long int bits) const
bool ignored(unsigned long long int bits) const
{
return bits & ignore_;
}
std::string bits_string() const
{
unsigned int size = max_;
unsigned long int one = 1;
unsigned long int bitmask = (one << (size - 1));
unsigned long long int one = 1;
unsigned long long int bitmask = (one << (size - 1));
std::stringstream str;
for (unsigned int i = 0; i < size; i++) {
if (ignore_ & (bitmask >> i))
Expand All @@ -184,7 +184,7 @@ namespace sirf {
return str.str();
}
private:
unsigned long int ignore_;
unsigned long long int ignore_;
unsigned int max_;
};

Expand Down

0 comments on commit 5ec1fac

Please sign in to comment.