--- gforth/prim 2000/08/09 20:04:06 1.52 +++ gforth/prim 2000/08/14 19:15:53 1.54 @@ -819,6 +819,7 @@ w2 = ~w1; MAXU xor ; rshift ( u1 n -- u2 ) core r_shift +""Logical shift right by @i{n} bits."" u2 = u1>>n; : 0 ?DO 2/ MAXI and LOOP ; @@ -2260,7 +2261,9 @@ c_addr=newline; u=sizeof(newline); : "newline count ; -Create "newline 1 c, $0A c, +Create "newline e? crlf [IF] 2 c, $0D c, [ELSE] 1 c, [THEN] $0A c, + +\+os utime ( -- dtime ) gforth ""Report the current time in microseconds since some epoch."" @@ -2286,6 +2289,10 @@ duser = timeval2us(&time1); dsystem = (DCell)0; #endif +\+ + +\+floating + v* ( f_addr1 nstride1 f_addr2 nstride2 ucount -- r ) gforth v_star ""dot-product: r=v1*v2. The first element of v1 is at f_addr1, the next at f_addr1+nstride1 and so on (similar for v2). Both vectors have @@ -2295,6 +2302,10 @@ for (r=0.; ucount>0; ucount--) { f_addr1 = (Float *)(((Address)f_addr1)+nstride1); f_addr2 = (Float *)(((Address)f_addr2)+nstride2); } +: + >r swap 2swap swap 0e r> 0 ?DO + dup f@ over + 2swap dup f@ f* f+ over + 2swap + LOOP 2drop 2drop ; faxpy ( ra f_x nstridex f_y nstridey ucount -- ) gforth ""vy=ra*vx+vy"" @@ -2303,3 +2314,9 @@ for (; ucount>0; ucount--) { f_x = (Float *)(((Address)f_x)+nstridex); f_y = (Float *)(((Address)f_y)+nstridey); } +: + >r swap 2swap swap r> 0 ?DO + fdup dup f@ f* over + 2swap dup f@ f+ dup f! over + 2swap + LOOP 2drop 2drop fdrop ; + +\+