memcpy is this
memcpy( writable_destination, const_source, length_in_bytes )

if you're unsure what it's doing, expand the arguments so the code is more 
readable (shame on whoever wrote this :)
memcpy(static_cast<char*>(buffer_->Data()) + bytes_used_, 
data,bytes_to_save);
...
auto* Destination = static_cast<char*>(buffer_->Data()); // start of buffer
Destination += bytes_used_; // offset from the start, same as Destination = 
&Destination[bytes_used_];
memcpy(Destination, data, bytes_to_save );

So to answer your question;

> with this memcpy is it copying from data which is a const char pointer n 
bytes_to_save into the array buffer_
No, it's copying the number of bytes *bytes_to_save* FROM *data* (from the 
start)

>  into a specific offset from the array 
yes, into a specific offset from the start of the array *Buffer->Data*

This isn't a v8 specific question, so you may get a better response for 
general C/++ questions on http://www.stackoverflow.com :)


On Monday, 3 September 2018 19:55:35 UTC+1, dan Med wrote:
>
> Can someone help me out ?
>
> Il giorno dom 2 set 2018 alle ore 11:26 <litoki...@gmail.com <javascript:>> 
> ha scritto:
>
>>  memcpy(static_cast<char*>(buffer_->Data()) + bytes_used_, 
>> data,bytes_to_save);
>>
>> with this memcpy is it copying from data which is a const char pointer n 
>> bytes_to_save into the array buffer_ or into a specific offset from the 
>> array ?
>>
>> -- 
>> -- 
>> v8-users mailing list
>> v8-u...@googlegroups.com <javascript:>
>> http://groups.google.com/group/v8-users
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to v8-users+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to