296296 return pos
297297end
298298
299+ # before Julia 1.10 these functions where defined in Ryu, however, they moved to Base and their syntax has changed.
300+ # we only use them here so we define them for our purpose
301+ _memcpy (d, doff, s, soff, n) = (ccall (:memcpy , Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, Csize_t), d + doff - 1 , s + soff - 1 , n); nothing )
302+ _memmove (d, doff, s, soff, n) = (ccall (:memmove , Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, Csize_t), d + doff - 1 , s + soff - 1 , n); nothing )
303+
299304# ## From Base.Ryu, because we need buf to be View of an array not vector (maybe we should change it in Ryu?)
300305function _writeshortest (buf, pos, x:: T ,
301306 plus= false , space= false , hash= true ,
@@ -436,10 +441,10 @@ function _writeshortest(buf, pos, x::T,
436441 c1 = (c ÷ 100 ) << 1
437442 d0 = (d % 100 ) << 1
438443 d1 = (d ÷ 100 ) << 1
439- Base . Ryu . memcpy (ptr, pos + olength - 2 , ptr2, c0 + 1 , 2 )
440- Base . Ryu . memcpy (ptr, pos + olength - 4 , ptr2, c1 + 1 , 2 )
441- Base . Ryu . memcpy (ptr, pos + olength - 6 , ptr2, d0 + 1 , 2 )
442- Base . Ryu . memcpy (ptr, pos + olength - 8 , ptr2, d1 + 1 , 2 )
444+ _memcpy (ptr, pos + olength - 2 , ptr2, c0 + 1 , 2 )
445+ _memcpy (ptr, pos + olength - 4 , ptr2, c1 + 1 , 2 )
446+ _memcpy (ptr, pos + olength - 6 , ptr2, d0 + 1 , 2 )
447+ _memcpy (ptr, pos + olength - 8 , ptr2, d1 + 1 , 2 )
443448 i += 8
444449 end
445450 output2 = output % UInt32
@@ -448,14 +453,14 @@ function _writeshortest(buf, pos, x::T,
448453 output2 = div (output2, UInt32 (10000 ))
449454 c0 = (c % 100 ) << 1
450455 c1 = (c ÷ 100 ) << 1
451- Base . Ryu . memcpy (ptr, pos + olength - i - 2 , ptr2, c0 + 1 , 2 )
452- Base . Ryu . memcpy (ptr, pos + olength - i - 4 , ptr2, c1 + 1 , 2 )
456+ _memcpy (ptr, pos + olength - i - 2 , ptr2, c0 + 1 , 2 )
457+ _memcpy (ptr, pos + olength - i - 4 , ptr2, c1 + 1 , 2 )
453458 i += 4
454459 end
455460 if output2 >= 100
456461 c = (output2 % UInt32 (100 )) << 1
457462 output2 = div (output2, UInt32 (100 ))
458- Base . Ryu . memcpy (ptr, pos + olength - i - 2 , ptr2, c + 1 , 2 )
463+ _memcpy (ptr, pos + olength - i - 2 , ptr2, c + 1 , 2 )
459464 i += 2
460465 end
461466 if output2 >= 10
@@ -498,7 +503,7 @@ function _writeshortest(buf, pos, x::T,
498503 end
499504 else
500505 pointoff = olength - abs (nexp)
501- Base . Ryu . memmove (ptr, pos + pointoff + 1 , ptr, pos + pointoff, olength - pointoff + 1 )
506+ _memmove (ptr, pos + pointoff + 1 , ptr, pos + pointoff, olength - pointoff + 1 )
502507 buf[pos + pointoff] = decchar
503508 pos += olength + 1
504509 precision -= olength
@@ -543,11 +548,11 @@ function _writeshortest(buf, pos, x::T,
543548
544549 if exp2 >= 100
545550 c = exp2 % 10
546- Base . Ryu . memcpy (ptr, pos, ptr2, 2 * div (exp2, 10 ) + 1 , 2 )
551+ _memcpy (ptr, pos, ptr2, 2 * div (exp2, 10 ) + 1 , 2 )
547552 buf[pos + 2 ] = UInt8 (' 0' ) + (c % UInt8)
548553 pos += 3
549554 elseif exp2 >= 10
550- Base . Ryu . memcpy (ptr, pos, ptr2, 2 * exp2 + 1 , 2 )
555+ _memcpy (ptr, pos, ptr2, 2 * exp2 + 1 , 2 )
551556 pos += 2
552557 else
553558 if padexp
0 commit comments