Pavel
you need to copy to each memory position once
I don't understand why. it's vector, one contiguous memory block of pod objects. should be memcpyble as I understand (even without allocation if destination vector is big enough)
BinaryByter
you want to copy one POD to multiple memory locations to have it in the vector multiple times, right?
BinaryByter
oh
BinaryByter
you can do vector::data() and memcpy from that
BinaryByter
is that what you want?
Pavel
is that what you want?
hm, probably, will try it too if std::copy don't help
BinaryByter
I don't really know what you want to do
Pavel
optimize that vector copying, as it looks too expensive in the profiler
BinaryByter
copying memory is not fast
aj
Can anyone help the fundamental procedures for declaring functions
olli
optimize that vector copying, as it looks too expensive in the profiler
I assume you're compiling using optimizations?
BinaryByter
if you want to speed it up a bit, use DMA
BinaryByter
will speed it up, help with heat spread and open the CPU up for something else
aj
Can anyone help the fundamental procedures for declaring functions in cpp
Dima
why would they need help
BinaryByter
ah right, I forgot
Dima
how come it is a spam 😂 it’s just the silly question
BinaryByter
he asked it twice
Dima
well two messages aren’t spam
BinaryByter
he tries very hard asking the question
Dima
😉
BinaryByter
they are two times the same message
Pavel
I assume you're compiling using optimizations?
well, now when you said it, I looked at the flags and it seems like I'm not 😅
BinaryByter
I mean
BinaryByter
It depends on what you want
BinaryByter
for learning its probably best
olli
well, now when you said it, I looked at the flags and it seems like I'm not 😅
In my case this will be emitted mov rdi, r12 mov rsi, r15 mov rdx, rbx call memcpy
BinaryByter
whats in rbx?
olli
number of bytes to copy
BinaryByter
no shit
BinaryByter
but what does the compiler generate
BinaryByter
just for curiosity, no bashing this time 😉
Red
Hi guys! I’m currently working with Verilator (a tool for simulation of circuit boards) and it generates some c++ code. And the thing it does is quite weird and I don’t really get what it is, i mean the VL_Module thing.. what is it? Is this some kind of wrapper around VTop call or something? It includes methods that i need, but they are not really methods, cause they have no return type and parameters are all weird..
BinaryByter
looks a lot like a macro
BinaryByter
look into "verilated.,h"
BinaryByter
you probably have a #define VL_MODULE <something>
Dima
yeah
Red
It really is!
BinaryByter
Hehe, there you have your answer 😉
Pavel
In my case this will be emitted mov rdi, r12 mov rsi, r15 mov rdx, rbx call memcpy
For some reason, it doesn't give me better result with -O2, but std::copy gave a huge improvement here (at least I don't see it anymore in the profiler, before that it was 11% of run time)
Pavel
thanks for the help
Red
Thanks anyways! Now it's a lot clearer!
Red
But still seems kinda strange
BinaryByter
But still seems kinda strange
a #define macro just tells the compiler "whenever you see this, replace it with that"
BinaryByter
you can collapse bigger codes into just one word
Red
I get it now.. thanks a lot @BinaryByter!
BinaryByter
Sure 😊
olli
but what does the compiler generate
basically std::vector<T>::end - std::vector<T>::begin.
BinaryByter
okay
BinaryByter
thanks 😊
olli
no worries (:
Anonymous
Hi Everyone.
S.
Hi everyone, this is shubham here
Anonymous
Anonymous
Is it so all floats are treated as double by modern compilers ?
Anonymous
And compiler
Anonymous
Try to compile a code using sizeof operator and see for yourself what's going on under the hood in a specific machine
Anonymous
/me wonders why some people typedef existing types xD
Mihail
/me wonders why some people typedef existing types xD
If you're talking about the fixed width integers then it actually makes a lot of sense
Mihail
Yes. Can you elaborate ?
Those typedef's are different per every platform. So a uint32_t might be a unsigned int on one platform, but an unsigned long on another. And with the fixed with integers the standard library implementors set them properly, so you can be assured that it'll be an unsigned integer type with 4bytes
Mihail
Makes your code less platform dependant
Mihail
And also easier to read imo
Mihail
https://en.cppreference.com/w/cpp/types/integer
Mihail
There you can read more about them
Ariana
Or do you have examples of cves where they just use brute force to completely break aslr, stack cookies, pie