Re: reassigning values to variables question

2019-02-05 Thread ToddAndMargo via perl6-users
On Sun, Feb 3, 2019 at 9:36 PM ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: Hi All, If I have a variable of type Buf which 1000 bytes in it and I find the five bytes I want, is it faster, slower, or no difference in speed to overwrite the same

VS_VERSION_INFO?

2019-02-05 Thread ToddAndMargo via perl6-users
Hi All, Anyone know how to find the pointer to VS_VERSION_INFO in a Windows .exe file? Supposedly, this link tells you but .. https://docs.microsoft.com/en-us/windows/desktop/debug/pe-format#section-table-section-headers Many thanks, -T

Re: binary test and position?

2019-02-05 Thread ToddAndMargo via perl6-users
On 2/5/19 7:55 AM, Brad Gilbert wrote: `index` is an NQP op, which means in this case that it is written in C (assuming you are using MoarVM) https://github.com/MoarVM/MoarVM/blob/ddde09508310a5f60c63474db8f9682bc922700b/src/strings/ops.c#L557-L656 The code I gave for finding a Buf inside of

Re: binary test and position?

2019-02-05 Thread ToddAndMargo via perl6-users
On 2/5/19 8:26 AM, Curt Tilmes wrote: If you have glibc (probably yes for Linux or Mac, probably no for Windows), you can call memmem(): use NativeCall; sub memmem(Blob $haystack, size_t $haystacklen,            Blob $needle,   size_t $needlelen --> Pointer) is native {} sub

Re: binary test and position?

2019-02-05 Thread Brad Gilbert
`index` is an NQP op, which means in this case that it is written in C (assuming you are using MoarVM) https://github.com/MoarVM/MoarVM/blob/ddde09508310a5f60c63474db8f9682bc922700b/src/strings/ops.c#L557-L656 The code I gave for finding a Buf inside of another one was quickly made in a way to

Re: reassigning values to variables question

2019-02-05 Thread yary
There are modules to time two pieces of code and show the difference https://github.com/perl6-community-modules/perl6-Benchy https://github.com/tony-o/perl6-bench You can write up the two versions you're thinking of, feed them to the benchmark module, and show us what you find! -y On Sun, Feb

Re: binary test and position?

2019-02-05 Thread Curt Tilmes
If you have glibc (probably yes for Linux or Mac, probably no for Windows), you can call memmem(): use NativeCall; sub memmem(Blob $haystack, size_t $haystacklen, Blob $needle, size_t $needlelen --> Pointer) is native {} sub buf-index(Blob $buffer, Blob $needle) {