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

libint-compiler: Fix build on mingw-w64 #344

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 0 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1269,9 +1269,6 @@ if test "X$have_posix_memalign" != "X0"; then
LIBINT_ALIGN_SIZE=0
fi
AC_DEFINE_UNQUOTED(LIBINT_ALIGN_SIZE, $LIBINT_ALIGN_SIZE)
else # no posix_memalign = death
echo "did not find posix_memalign ... this SHOULD NOT happen. Cannot proceed."
exit 1
fi

dnl ------------------ Check for support for C++11 standard features --------------
Expand Down
4 changes: 2 additions & 2 deletions src/bin/libint/tactic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ RandomChoiceTactic::RR RandomChoiceTactic::optimal_rr(
const rr_stack& stack) const {
if (!stack.empty()) {
unsigned int size = stack.size();
unsigned long rand = random();
unsigned long rand_ = random();
const unsigned long range = RAND_MAX;
long choice = (long)(rand * size - 1) / range;
long choice = (long)(rand_ * size - 1) / range;
return stack[choice];
} else
return RR();
Expand Down
9 changes: 7 additions & 2 deletions src/bin/libint/tactic.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
#ifndef _libint2_src_bin_libint_tactic_h_
#define _libint2_src_bin_libint_tactic_h_

#ifdef _WIN32
#define random rand
#define srandom srand
#endif

namespace libint2 {

class DirectedGraph;
Expand Down Expand Up @@ -208,10 +213,10 @@ class StdRandomizePolicy {
}

unsigned int noise(unsigned int nrrs) const {
unsigned long rand = random();
unsigned long rand_ = random();
const unsigned long range = RAND_MAX;
const unsigned int result =
static_cast<unsigned int>(std::floor(nrrs * scale_ * rand / range));
static_cast<unsigned int>(std::floor(nrrs * scale_ * rand_ / range));
return result;
}

Expand Down
Loading