* Bug #13036 fixed - Help page associated to history browser was wrong.
+* Bug #13041 fixed - Wrong result was returned for "integer scalar" minus "integer vector".
+
* Bug #13042 fixed - Texts in graphics were not correctly centered.
* Bug #13047 fixed - jcompile did not allow class reloading.
*/
INTEGER_IMPEXP int C2F(gensubst)(int *typ, int *n, int *dx, int *incx, int *dy, int *incy);
+INTEGER_IMPEXP int C2F(gensubst1)(int *typ, int *n, int *dx, int *incx, int *dy, int *incy);
+
#endif /* __GENSUBST_H__ */
return 0;
}
+#define SUBST1(Type) {\
+Type *DX;\
+Type *DY;\
+ DX=(Type *)dx;\
+ --DX;\
+ DY=(Type *)dy;\
+ --DY;\
+ if (*incx == 1 && *incy == 1){\
+ for (i = 1; i <= i1; ++i) DX[i] = DY[i] - DX[i];\
+ }\
+ else {\
+ ix = 1; iy = 1;\
+ if (*incx < 0) ix = (-(*n) + 1) * *incx + 1;\
+ if (*incy < 0) iy = (-(*n) + 1) * *incy + 1;\
+ for (i = 1; i <= i1; ++i) {\
+ DX[ix] = DY[iy] - DX[ix];\
+ ix += *incx; iy += *incy;\
+ }\
+ }\
+}
+
+
+
+int C2F(gensubst1)(int *typ, int *n, int *dx, int *incx, int *dy, int *incy)
+{
+ static int i, ix, iy, i1;
+ i1 = *n;
+ if (i1 <= 0)
+ {
+ return 0;
+ }
+
+ switch (*typ)
+ {
+ case 1:
+ SUBST1(integer1);
+ break;
+ case 2:
+ SUBST1(integer2);
+ break;
+ case 4:
+ SUBST1(int) ;
+ break;
+ case 11:
+ SUBST1(unsigned char);
+ break;
+ case 12:
+ SUBST1(unsigned short);
+ break;
+ case 14:
+ SUBST1(unsigned int);
+ break;
+ }
+ return 0;
+}
+
c . cst-vector
call gencopy(it1,1,istk(l1),1,is1,1)
call gencopy(it1,mn2,istk(l2),1,istk(l1),1)
- call gensubst(it1,mn2,istk(l1),1,is1,0)
+ call gensubst1(it1,mn2,istk(l1),1,is1,0)
lstk(top+1)=sadr(l1+memused(it1,mn2))
istk(il1+1)=m2
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET
+//
+// This file is distributed under the same license as the Scilab package.
+// ===========================================================================
+//
+// <-- Non-regression test for bug 13041 -->
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/13041
+//
+// <-- Short Description -->
+// Invalid result with int minus vect_int
+//
+b = int8(-9);
+a = int8([-7 5]);
+assert_checkequal(-a+b, b-a);
+b = int16(-9);
+a = int16([-7 5]);
+assert_checkequal(-a+b, b-a);
+b = int32(-9);
+a = int32([-7 5]);
+assert_checkequal(-a+b, b-a);
+b = uint8(-9);
+a = uint8([-7 5]);
+assert_checkequal(-a+b, b-a);
+b = uint16(-9);
+a = uint16([-7 5]);
+assert_checkequal(-a+b, b-a);
+b = uint32(-9);
+a = uint32([-7 5]);
+assert_checkequal(-a+b, b-a);
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Calixte DENIZET
+//
+// This file is distributed under the same license as the Scilab package.
+// ===========================================================================
+//
+// <-- Non-regression test for bug 13041 -->
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/13041
+//
+// <-- Short Description -->
+// Invalid result with int minus vect_int
+//
+
+b = int8(-9);
+a = int8([-7 5]);
+assert_checkequal(-a+b, b-a);
+
+b = int16(-9);
+a = int16([-7 5]);
+assert_checkequal(-a+b, b-a);
+
+b = int32(-9);
+a = int32([-7 5]);
+assert_checkequal(-a+b, b-a);
+
+b = uint8(-9);
+a = uint8([-7 5]);
+assert_checkequal(-a+b, b-a);
+
+b = uint16(-9);
+a = uint16([-7 5]);
+assert_checkequal(-a+b, b-a);
+
+b = uint32(-9);
+a = uint32([-7 5]);
+assert_checkequal(-a+b, b-a);
+