Anonymous
is this wrong;-
Anonymous
char names[] = {'zero','one','two','three','four','five','six','seven','eight','nine'};
Anonymous
string names[] = {'zero','one','two','three','four','five','six','seven','eight','nine'};
☬ੴ Bassi
ii thought strings had to be in " "
☬ੴ Bassi
Indolent
☬ੴ Bassi
Sometimes it's best to comment out the noise and focus on that little bit
☬ੴ Bassi
Like the first cout
samuel
Anyone here who can help.mee
samuel
I want a code for this pattern
samuel
samuel
Plz help me
Dima
@roxifas
Roxifλsz 🇱🇹
Roxifλsz 🇱🇹
@roxifas
You really could've done that yourself
☬ੴ Bassi
why did he get banned
Vinícius
/get ide
Mar!o
I've created a little benchmark to benchmark the following:
What is faster:
Having one array of elements and passing around indices to elements. Like:
std::vector<int>
Iterating over it should be faster because the elements directly will be in the cache.
VS
std::vector<int*>
For some reason the pointer variant was faster in lookups AND iterating over it!!! HOW??
Alex
Mar!o
I had many structs, some referred to element by indices:
std::size_t nodeElem;
and in the second version:
int* nodeElemt;
I just don't get it how pointers can be faster when iterating because the cache will be invalidated each time because
the int s are somewhere random on the heap while with the first version they will be in cache.
Mar!o
I know pointers to vector elements are UB but I prevented reallocations
Mar!o
V01D
Okay, I am not getting this..
Goal: convert decimal to hex.
Hex value is 0xA ~ Decimal: 10
The calculation is: 10 / 16 % 16
Result should be: 10? (Technically 0.something, but I need to extract the decimal value from the hex value.)
I am getting 15 back (working with int's.)
I can't use stdlib for this. (It is for a kernel)
Anonymous
Vlad
Vlad
V01D
Yeah
V01D
Language is C
Vlad
I think you can store char symbols[16] = "0123456789ABCDEF" and then do power of 16 based division
Vlad
And extract needed symbol given index
su
Mar!o
V01D
V01D
I will try to make an enum with:
decimal_num = hex_num
.
In the function I will check if the result of the division = the enum[resultofdiv] by looping through the enum.
I just need to figure out why the equation doesn't work.
Vlad
Vlad
Also strlen on _ulong64* is very suspicious
Vlad
And I don't know why do you pass pointer in the first place.
V01D
Vlad
V01D
I am also not 100% when to use pointers and when not to.
V01D
In this case it seems I forgot to take it out.
Vlad
Vlad
And 8 bytes isn't that big of a deal to copy over
Vlad
Vlad
Cause that's exactly what you need in this case
V01D
I have putc and putc_at, so yes.
V01D
So you are saying to take the each character in the hexvalue, convert it to a char, and call putc?
Vlad
Navjot
Anyone help me plzz
Navjot
How to convert 32 bit .exe into 64 🤔
Vlad
Navjot
Navjot
Recompile it
I did brother...but didn't took place..
Vlad
Vlad
8 is 32 bits
Dima
Navjot
V01D
So:
for (int i....) {
result = hex[i]; //Get char
tostr(result);
result = pow(16, i);
putc(result);
}
Something like this?
Vlad
Kinda like this. Then print it in reverse order.
Vlad
putc(hex[values[i]]);
Vlad
Also I guess you could optimize away pow by bit shifting
V01D
What is going on in that for loop?
Why values[i-1] twice, and why i-1 at all?
why is the array accessed backwards?
Vlad
Vlad
V01D
Vlad
Vlad
I guess this whole modulo thingy wouldn't work otherwise
Vlad
Vlad
But you've got to print it reversed