@@ -21052,7 +21052,7 @@ namespace cimg_library {
2105221052 } else if (is_push_heap) arg2 = ~0U - 1;
2105321053 else arg2 = ~0U;
2105421054 CImg<ulongT>::vector((ulongT)mp_da_insert_or_push_n,_cimg_mp_slot_nan,p1,arg1,arg2,0,0).move_to(l_opcode);
21055- pos = (p1==~0U?2:3) + (is_n?1:0);
21055+ pos = (p1==~0U?2:3) + (is_n?1:0) + (is_insert?1:0) ;
2105621056 p1 = ~0U;
2105721057 for (s = s1; s<se; ++s) {
2105821058 ns = s; while (ns<se && (*ns!=',' || level[ns - expr._data]!=clevel1) &&
@@ -26604,7 +26604,7 @@ namespace cimg_library {
2660426604 pos0 = is_push?siz:(int)_mp_arg(4),
2660526605 pos = pos0<0?pos0 + siz:pos0;
2660626606
26607- if (img && nb_elts && dim1!=img._spectrum)
26607+ if (img && dim1!=img._spectrum)
2660826608 throw CImgArgumentException("[" cimg_appname "_math_parser] CImg<%s>: Function '%s()': "
2660926609 "Element to insert has invalid size %u (should be %u).",
2661026610 mp.imgout.pixel_type(),s_op,dim1,img._spectrum);
@@ -26626,11 +26626,9 @@ namespace cimg_library {
2662626626 cimg_forC(img,c) std::memmove(img.data(0,pos + count*nb_elts1,0,c),img.data(0,pos,0,c),(siz - pos)*sizeof(T));
2662726627
2662826628 if (!dim) { // Scalar or vector1() elements
26629- for (unsigned int k = 0; k<nb_elts; ++k)
26630- img[pos + k] = (T)_mp_arg(7 + k);
26629+ for (unsigned int k = 0; k<nb_elts; ++k) img[pos + k] = (T)_mp_arg(7 + k);
2663126630 if (count>1)
26632- for (unsigned int k = 1; k<count; ++k)
26633- std::memcpy(&img[pos + k*nb_elts],&img[pos],nb_elts*sizeof(T));
26631+ for (unsigned int k = 1; k<count; ++k) std::memcpy(&img[pos + k*nb_elts],&img[pos],nb_elts*sizeof(T));
2663426632 if (is_push_heap) for (unsigned int k = 0; k<nb_elts; ++k) {
2663526633 int index = pos + k;
2663626634 while (index>0) { // Heapify-up
0 commit comments