Skip to content

Commit

Permalink
* Eliminated _MSC_VER define when compiling under MinGW
Browse files Browse the repository at this point in the history
 * Added copy of pol51-intel executables to a name without the suffix, so
   the factLat.pl script can still find them.  It really should be a
   symlink, but under MinGW, "ln -s" is a synonym for cp, and cp does not
   treat relative pathnames in the same way that ln does.
 * Fixed makesymlinks.sh


git-svn-id: https://ggnfs.svn.sourceforge.net/svnroot/ggnfs/trunk@98 80ef69ca-9341-0410-9d60-8acc7774fa31
  • Loading branch information
trilliwig committed Aug 25, 2005
1 parent 0f3ce13 commit 6bf4861
Show file tree
Hide file tree
Showing 19 changed files with 45 additions and 41 deletions.
6 changes: 6 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
src/lasieve4/ppc32, and src/pol5. Anyone able to try if the itanium
or mips lattice siever code works? :)
* Added Makefile to tests/snfs_small
* Eliminated _MSC_VER define when compiling under MinGW
* Added copy of pol51-intel executables to a name without the suffix, so
the factLat.pl script can still find them. It really should be a
symlink, but under MinGW, "ln -s" is a synonym for cp, and cp does not
treat relative pathnames in the same way that ln does.
* Fixed makesymlinks.sh

8/24/05 (relf)
* lasieve-asm.h renamed to siever-config.h
Expand Down
10 changes: 3 additions & 7 deletions include/ggnfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
#ifndef _GGNFS_H
#define _GGNFS_H

#if defined (__MINGW32__) || defined (MINGW32)
#define _MSC_VER 1300
#endif

#include <gmp.h>

#if defined (__cplusplus)
Expand All @@ -37,7 +33,7 @@ typedef unsigned char uchar;
#include <stdio.h>
#include <stdarg.h>
#define __STDC_FORMAT_MACROS
#if defined (_MSC_VER) && !defined(__MINGW32__)
#if defined (_MSC_VER)
#include <basetsd.h>

#define int8_t INT8
Expand Down Expand Up @@ -579,7 +575,7 @@ static inline s32 mulmod32(uint32_t x, uint32_t y, uint32_t m)
{
return ((uint64_t)x*(uint64_t)y%m);
}
#elif defined( _MSC_VER ) && !defined(__MINGW32__)
#elif defined( _MSC_VER )
#else
extern s32 mulmod32(s32 op1, s32 op2, s32 modulus) asm("mulmod32");
#endif
Expand Down Expand Up @@ -778,7 +774,7 @@ unsigned int get_next_prime();

#define NFS_HASH_Q(_a, _b, _k) (((u32)(3*(_a/2)+(_b)))%(_k))

#if defined ( _MSC_VER ) && !defined( __MINGW32__ )
#if defined ( _MSC_VER )
#define MULMOD32(_res, _op1, _op2, _mod) __asm mov eax,_op1 __asm imul _op2 __asm idiv _mod __asm mov _res,edx
#elif defined(__ppc__)
#define MULMOD32(_res, _op1, _op2, _mod) _res = mulmod32(_op1, _op2, _mod)
Expand Down
4 changes: 2 additions & 2 deletions makesymlinks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
#cd src; ln -s Makefile.athlon Makefile; cd ..
#cd src/lasieve4; ln -s piii asm; cd ../..

chmod a+x src/autogplot.sh
chmod a+x bin/autogplot.sh
chmod a+x tests/factLat.pl
echo "Symbolic links have been created and execute permissions have been fixed."
echo "Execute permissions have been fixed."
6 changes: 3 additions & 3 deletions src/blanczos64.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@

/* I really hope, these defines sometimes will be in the config file... */

#if defined(__GNUC__) || defined(__MINGW32__)
#if defined(__GNUC__) || defined(__MINGW32__) || defined(MINGW32)
#define ALIGNED16(x) x __attribute__ ((aligned (16)))
#elif defined(_MSC_VER) && !defined(__MINGW32__)
#elif defined(_MSC_VER)
#define ALIGNED16(x) __declspec(align(16)) x
#else
#define ALIGNED16(x) x
Expand All @@ -49,7 +49,7 @@
#if defined( __GNUC__ )
#define USE_MMX_GCC
#define GGNFS_ATT_ASSEMBLER
#elif defined( _MSC_VER )
#elif defined( _MSC_VER ) || defined( __MINGW32__ ) || defined ( MINGW32 )
#define GGNFS_MSC_ASSEMBLER
#define USE_MMX_MSC
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/if.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include <time.h>

#if defined (__MINGW32__)
#if defined (__MINGW32__) || defined (MINGW32)
#include <io.h>
#elif defined(_MSC_VER)
#include <io.h>
Expand All @@ -36,7 +36,7 @@

int verbose = 0;
static size_t used_cols, ncol = 80;
#if defined( __CYGWIN__ ) || defined( _MSC_VER ) || defined(__MINGW32__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
#if defined( __CYGWIN__ ) || defined( _MSC_VER ) || defined(__MINGW32__) || defined (MINGW32) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
#define NEED_GETLINE
#define NEED_ASPRINTF
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/lasieve4/gnfs-lasieve4e.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <string.h>
#include <time.h>

#if defined (_MSC_VER) || defined (__MINGW32__)
#if defined (_MSC_VER) || defined (__MINGW32__) || defined (MINGW32)
#include "getopt.h"
#define popen _popen
#define pclose _pclose
Expand All @@ -33,7 +33,7 @@
#ifdef LINUX
#include <endian.h>
#endif
#ifndef _MSC_VER
#if !defined (_MSC_VER)
#include <sys/time.h>
#endif

Expand Down Expand Up @@ -453,7 +453,7 @@ void getFB(int force_aFBcalc)
/*******************************************************/
double sTime()
/*******************************************************/
#if !defined (_MSC_VER) && !defined (__MINGW32__)
#if !defined (_MSC_VER) && !defined (__MINGW32__) && !defined (MINGW32)
{ static struct timeval this_tv;
static struct timezone dumbTZ;
double t;
Expand Down Expand Up @@ -538,7 +538,7 @@ inline void optsieve(uint32_t st1, uchar* i_o, uchar* i_max, size_t j) {
x |= x << 16;
x |= x << 32;
while (i_o < i_max) {
#if defined(_MSC_VER) && !defined(__MINGW32__)
#if defined(_MSC_VER)
__asm {
mov esi,[i_o]
mov edi,[i_max]
Expand Down
2 changes: 1 addition & 1 deletion src/lasieve4/piii/montgomery_mul.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ mpz_t montgomery_gmp_help;
evaluates to asm(x) on gcc, empty on others. This way we would
have just the one collection of prototypes here. I'll get to it.
*/
#if !defined(_MSC_VER) || defined(__MINGW32__)
#if !defined(_MSC_VER)
/* function pointers */
void (*asm_mulmod) (uint32_t *, uint32_t *, uint32_t *) = NULL;
extern void asm_mulm64(uint32_t *, uint32_t *, uint32_t *) asm("asm_mulm64");
Expand Down
6 changes: 3 additions & 3 deletions src/lasieve4/piii/siever-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ extern const uint32_t schedule_primebounds[N_PRIMEBOUNDS];
extern const uint32_t schedule_sizebits[N_PRIMEBOUNDS];
void siever_init(void);

#if !defined(_MSC_VER) || defined (__MINGW32__)
#if !defined(_MSC_VER)
#define NAME(_a) asm(_a)
#else
#define NAME(_a)
#endif

#if defined(_MSC_VER) && !defined(__MINGW32__)
#if defined(_MSC_VER)

#define inline __inline

Expand Down Expand Up @@ -251,7 +251,7 @@ int asm_td(uint16_t *, uint16_t, uint64_t*, uint32_t*) NAME("asm_td");

/* misc arithmetic files: */

#if !defined(_MSC_VER) || defined(__MINGW32__)
#if !defined(_MSC_VER)

extern void asm_mulm64(uint32_t *, uint32_t *, uint32_t *) NAME("asm_mulm64");
extern void asm_mulm96(uint32_t *, uint32_t *, uint32_t *) NAME("asm_mulm96");
Expand Down
2 changes: 1 addition & 1 deletion src/matbuild-tpie.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include "if.h"

#ifndef _MSC_VER
#if !defined(_MSC_VER)
#include <sys/time.h>
#endif
#include "ggnfs.h"
Expand Down
2 changes: 1 addition & 1 deletion src/matbuild.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include "if.h"

#ifndef _MSC_VER
#if !defined(_MSC_VER)
#include <sys/time.h>
#endif
#include "ggnfs.h"
Expand Down
2 changes: 1 addition & 1 deletion src/matsolve.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include "if.h"

#ifndef _MSC_VER
#if !defined(_MSC_VER)
#include <sys/time.h>
#endif
#include "ggnfs.h"
Expand Down
6 changes: 3 additions & 3 deletions src/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
#include <stdarg.h>
#include <string.h>
#include <time.h>
#ifndef _MSC_VER
#if !defined(_MSC_VER)
#include <sys/time.h>
#endif

#include "ggnfs.h"

#ifdef MALLOC_REPORTING
#ifdef __MINGW32__
#if defined(__MINGW32__) || defined(MINGW32)
#include "malloc.h"
#else
#include <malloc.h>
Expand All @@ -44,7 +44,7 @@
/*******************************************************/
INLINE double sTime()
/*******************************************************/
#ifndef _MSC_VER
#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(MINGW32)
{ static struct timeval this_tv;
static struct timezone dumbTZ;
double t;
Expand Down
3 changes: 3 additions & 0 deletions src/pol5/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pol51m0b-alpha.o: pol51m0b.c ../if.h

$(BINDIR)/pol51m0b-intel: pol51m0b-intel.o ../if.o zeit-intel.o asm_hash5.o fnmatch.o primes.o assess.o roots.o
$(CC) $(INC) $(CFLAGS) -o $@ $^ $(LIBFLAGS) $(LIBS)
cp -f $(BINDIR)/pol51m0b-intel $(BINDIR)/pol51m0b

$(BINDIR)/pol51m0b-alpha: pol51m0b-alpha.o ../if.o zeit-alpha.o asm_hash5_alpha.o primes.o assess.o roots.o
$(CC) $(INC) $(CFLAGS) -o $@ $^ $(LIBFLAGS) $(LIBS)
Expand All @@ -64,6 +65,7 @@ pol51m0n-alpha.o: pol51m0n.c ../if.h

$(BINDIR)/pol51m0n-intel: pol51m0n-intel.o ../if.o zeit-intel.o fnmatch.o asm_hash5n.o primes.o assess.o roots.o
$(CC) $(INC) $(CFLAGS) -o $@ $^ $(LIBFLAGS) $(LIBS)
cp -f $(BINDIR)/pol51m0n-intel $(BINDIR)/pol51m0n

$(BINDIR)/pol51m0n-alpha: pol51m0n-alpha.o ../if.o zeit-alpha.o asm_hash5n_alpha.o primes.o assess.o roots.o
$(CC) $(INC) $(CFLAGS) -o $@ $^ $(LIBFLAGS) $(LIBS)
Expand All @@ -78,6 +80,7 @@ pol51opt-intel.o: pol51opt.c ../if.h

$(BINDIR)/pol51opt-intel: pol51opt-intel.o ../if.o primes.o assess.o roots.o zeit-intel.o fnmatch.o asm_rs.o
$(CC) $(INC) $(CFLAGS) -o $@ $^ $(LIBFLAGS) $(LIBS)
cp -f $(BINDIR)/pol51opt-intel $(BINDIR)/pol51opt

clean : ;
rm -f $(BINS) $(BINS_INTEL) *.o core
Expand Down
9 changes: 4 additions & 5 deletions src/pol5/pol51m0b.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
#define HAVE_ASM
#endif

#if defined(_MSC_VER) && !defined(__MINGW32__)
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(MINGW32)
#include "ggnfs.h"
typedef unsigned char uchar;
typedef unsigned long long uint64_t;
#endif

Expand Down Expand Up @@ -196,7 +195,7 @@ volatile unsigned int modulo32 asm ("modulo32");
static inline unsigned int modmul32(unsigned int x,unsigned int y)
{
unsigned int res,clobber;
#if defined(_MSC_VER) && !defined(__MINGW32__)
#if defined(_MSC_VER)
__asm
{
mov eax,x
Expand Down Expand Up @@ -913,7 +912,7 @@ void raw_hash_4()
#ifdef HAVE_ASM_INTEL
static void ulladdmul(uint64_t *resptr, unsigned int ulf, uint64_t *ullfptr)
{
#if defined(_MSC_VER) && !defined(__MINGW32__)
#if defined(_MSC_VER)
__asm
{ mov esi,ullfptr
mov edi,resptr
Expand Down Expand Up @@ -963,7 +962,7 @@ static void ulladdmul(uint64_t *resptr, unsigned int ulf, uint64_t *ullfptr)
/* for intel this is not necessary since we have 64bit long double */
static void ull_mulh(uint64_t *resptr, uint64_t *ullf1, uint64_t *ullf2)
{
#if defined(_MSC_VER) && !defined(__MINGW32__)
#if defined(_MSC_VER)
__asm
{
mov esi,ullf1
Expand Down
8 changes: 4 additions & 4 deletions src/pol5/pol51m0n.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define HAVE_ASM
#endif

#if defined(_MSC_VER) && !defined(__MINGW32__)
#if defined(_MSC_VER)
#include "ggnfs.h"
#endif

Expand Down Expand Up @@ -208,7 +208,7 @@ volatile unsigned int modulo32 asm ("modulo32");
static inline unsigned int modmul32(unsigned int x,unsigned int y)
{
unsigned int res,clobber;
#if defined(_MSC_VER) && !defined(__MINGW32__)
#if defined(_MSC_VER)
__asm
{
mov eax,x
Expand Down Expand Up @@ -1319,7 +1319,7 @@ void raw_hash_4()
#ifdef HAVE_ASM_INTEL
static void ulladdmul(uint64_t *resptr, unsigned int ulf, uint64_t *ullfptr)
{
#if defined(_MSC_VER) && !defined(__MINGW32__)
#if defined(_MSC_VER)
__asm
{ mov esi,ullfptr
mov edi,resptr
Expand Down Expand Up @@ -1369,7 +1369,7 @@ static void ulladdmul(uint64_t *resptr, unsigned int ulf, uint64_t *ullfptr)
/* for intel this is not necessary since we have 64bit long double */
static void ull_mulh(uint64_t *resptr, uint64_t *ullf1, uint64_t *ullf2)
{
#if defined(_MSC_VER) && !defined(__MINGW32__)
#if defined(_MSC_VER)
__asm
{
mov esi,ullf1
Expand Down
2 changes: 1 addition & 1 deletion src/pol5/zeit.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extern void *xmalloc(size_t size);
#ifdef HAVE_ASM_INTEL
static inline void asmgetclock(uint64_t *clptr)
{
#if defined(_MSC_VER) && !defined(__MINGW32__)
#if defined(_MSC_VER)
__asm
{
rdtsc
Expand Down
2 changes: 1 addition & 1 deletion src/procrels.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#define MAX_AB_EXTRA_ENTRIES 80000


#ifndef _MSC_VER
#if !defined(_MSC_VER)
#include <sys/time.h>
#endif
#include "ggnfs.h"
Expand Down
2 changes: 1 addition & 1 deletion src/sieve.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ int main(int argC, char *args[])
#ifdef _CATCH_SIGNALS
signal(SIGTERM, catch_term);
signal(SIGINT, catch_term);
#ifndef _MSC_VER
#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(MINGW32)
signal(SIGQUIT, catch_term);
#endif
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/sqrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <sys/types.h>
#include <sys/stat.h>

#ifndef _MSC_VER
#if !defined(_MSC_VER)
#include <sys/time.h>
#endif
#include "ggnfs.h"
Expand Down

0 comments on commit 6bf4861

Please sign in to comment.