Skip to content

Commit

Permalink
Merge pull request #2046 from gap-system/stable-4.9
Browse files Browse the repository at this point in the history
Merge stable-4.9 into master
  • Loading branch information
alex-konovalov authored Dec 23, 2017
2 parents ee54ef5 + fe8b768 commit b803d4f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 29 deletions.
9 changes: 8 additions & 1 deletion cnf/gac.in
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ c_link_dyn () {
output_la=${1%.so}.la
output_dir=$(dirname $1)
${c_dyn_linker} ${GAP_LDFLAGS} -o "$output_la" $2 ${c_addlibs} || exit 1
cp -r $output_dir/.libs/*.so $output_dir
if [ X"$SYS_IS_CYGWIN32" = X"yes" ] ; then
# GAP assumes shared libraries end in .so
for dllfile in `cd $output_dir/.libs; ls *.dll`; do
cp $output_dir/.libs/$dllfile $output_dir/${dllfile%.dll}.so
done
else
cp $output_dir/.libs/*.so $output_dir
fi;
}


Expand Down
21 changes: 13 additions & 8 deletions src/code.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,23 @@ enum STAT_TNUM {

T_PROCCALL_OPTS,

// The statement types between FIRST_NON_INTERRUPT_STAT
// and LAST_NON_INTERRUPT_STAT will not be interrupted (which may happen for two reasons:
// the user interrupted, e.g. via ctrl-c; or memory run full).
// They are all statement types which either contain sub-statements
// (and hence are not easy to interpret in backtraces), or else are
// ephemeral (break, continue, return)
// TODO: what about T_EMPTY and T_ATOMIC ?
// T_EMPTY could also be considered to be "T_SEQ_STAT0", but it
// must be an interruptible statement, so that loops with empty
// body can be interrupted.
T_EMPTY,

// The statement types between FIRST_NON_INTERRUPT_STAT and
// LAST_NON_INTERRUPT_STAT will not be interrupted (which may
// happen for two reasons: the user interrupted, e.g. via
// ctrl-c; or memory run full). They are all statement types
// which either contain sub-statements (and hence are not easy
// to interpret in backtraces), or else are ephemeral (break,
// continue, return)
// TODO: what about T_ATOMIC ?
START_ENUM_RANGE(FIRST_NON_INTERRUPT_STAT),

START_ENUM_RANGE(FIRST_COMPOUND_STAT),

T_EMPTY, // may also be considered to be "T_SEQ_STAT0"
T_SEQ_STAT,
T_SEQ_STAT2,
T_SEQ_STAT3,
Expand Down
6 changes: 2 additions & 4 deletions src/integer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2214,10 +2214,8 @@ Obj LcmInt(Obj opL, Obj opR)
CHECK_INT(opL);
CHECK_INT(opR);

if (opL == INTOBJ_INT(0))
return AbsInt(opR);
if (opR == INTOBJ_INT(0))
return AbsInt(opL);
if (opL == INTOBJ_INT(0) || opR == INTOBJ_INT(0))
return INTOBJ_INT(0);

sizeL = SIZE_INT_OR_INTOBJ(opL);
sizeR = SIZE_INT_OR_INTOBJ(opR);
Expand Down
38 changes: 22 additions & 16 deletions tst/testinstall/intarith.tst
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,16 @@ gap> RemInt(bigNeg, bigPos*bigNeg);
#
# GcdInt
#
gap> List(dataNonZero, x -> GcdInt(bigNeg, x));
[ 1, 100000000000000000000, 10000, 1, 1, 10000, 100000000000000000000, 1 ]
gap> List(dataNonZero, x -> GcdInt(smlNeg, x));
[ 1, 10000, 10000, 1, 1, 10000, 10000, 1 ]
gap> List(dataNonZero, x -> GcdInt(smlPos, x));
[ 1, 10000, 10000, 1, 1, 10000, 10000, 1 ]
gap> List(dataNonZero, x -> GcdInt(bigPos, x));
[ 1, 100000000000000000000, 10000, 1, 1, 10000, 100000000000000000000, 1 ]
gap> List(data, x -> GcdInt(bigNeg, x));
[ 1, 100000000000000000000, 10000, 1, 100000000000000000000, 1, 10000,
100000000000000000000, 1 ]
gap> List(data, x -> GcdInt(smlNeg, x));
[ 1, 10000, 10000, 1, 10000, 1, 10000, 10000, 1 ]
gap> List(data, x -> GcdInt(smlPos, x));
[ 1, 10000, 10000, 1, 10000, 1, 10000, 10000, 1 ]
gap> List(data, x -> GcdInt(bigPos, x));
[ 1, 100000000000000000000, 10000, 1, 100000000000000000000, 1, 10000,
100000000000000000000, 1 ]

#
gap> g:=3^10*257;; a:=g*991;; b:=g*1601;;
Expand All @@ -439,6 +441,8 @@ gap> GcdInt(1,fail);
Error, GcdInt: <right> must be an integer (not a boolean or fail)

# corner cases
gap> GcdInt(0, 0);
0
gap> GcdInt(-2^60, -2^60);
1152921504606846976
gap> GcdInt(-2^28, -2^28);
Expand All @@ -447,20 +451,20 @@ gap> GcdInt(-2^28, -2^28);
#
# LcmInt
#
gap> List(dataNonZero, x -> LcmInt(bigNeg, x));
gap> List(data, x -> LcmInt(bigNeg, x));
[ 10000000000000000000100000000000000000000, 100000000000000000000,
100000000000000000000, 100000000000000000000, 100000000000000000000,
100000000000000000000, 100000000000000000000, 0, 100000000000000000000,
100000000000000000000, 100000000000000000000,
10000000000000000000100000000000000000000 ]
gap> List(dataNonZero, x -> LcmInt(smlNeg, x));
[ 1000000000000000000010000, 100000000000000000000, 10000, 10000, 10000,
gap> List(data, x -> LcmInt(smlNeg, x));
[ 1000000000000000000010000, 100000000000000000000, 10000, 10000, 0, 10000,
10000, 100000000000000000000, 1000000000000000000010000 ]
gap> List(dataNonZero, x -> LcmInt(smlPos, x));
[ 1000000000000000000010000, 100000000000000000000, 10000, 10000, 10000,
gap> List(data, x -> LcmInt(smlPos, x));
[ 1000000000000000000010000, 100000000000000000000, 10000, 10000, 0, 10000,
10000, 100000000000000000000, 1000000000000000000010000 ]
gap> List(dataNonZero, x -> LcmInt(bigPos, x));
gap> List(data, x -> LcmInt(bigPos, x));
[ 10000000000000000000100000000000000000000, 100000000000000000000,
100000000000000000000, 100000000000000000000, 100000000000000000000,
100000000000000000000, 100000000000000000000, 0, 100000000000000000000,
100000000000000000000, 100000000000000000000,
10000000000000000000100000000000000000000 ]

Expand All @@ -484,6 +488,8 @@ gap> LcmInt(1,fail);
Error, LcmInt: <right> must be an integer (not a boolean or fail)

# corner cases
gap> LcmInt(0, 0);
0
gap> LcmInt(-2^60, -2^60);
1152921504606846976
gap> LcmInt(-2^28, -2^28);
Expand Down

0 comments on commit b803d4f

Please sign in to comment.