Ariana
Ariana
The add or multiply by 2 thing
数学の恋人
okay
BinaryByter
bitfields are really great
BinaryByter
though they ARE slower
BinaryByter
but then again
BinaryByter
do ACPI without bitfields
Abhishek
How about doing this in Karatsuba Algorithm?
数学の恋人
Abhishek
Ok
Abhishek
Actually my task is to multiply two numbers of 256 digits using karatsuba
Abhishek
As you wish
数学の恋人
Okay I'll try
Abhishek
But still I would love to do this myself
Abhishek
You can guide me
数学の恋人
数学の恋人
but let me understand it compeletely
Abhishek
Ok
Anonymous
Okk
数学の恋人
Abhishek
Yeah
Abhishek
Sur
Abhishek
*sure
BinaryByter
How to implement
namespace std {
template<class t>
class is_union;
}
?
BinaryByter
cppreference.com doesn'T show an example implementation and the only thing the web finds is an example for std::is_class
BinaryByter
also, the type_traits that's on my computer looks like this:
BinaryByter
BinaryByter
so not helpful
BinaryByter
waaaaaiiiiiiiiiiiiiiiiiiit
BinaryByter
__is_union(type)
seems to be a feature of Gcc
BinaryByter
#compilertrickery
BinaryByter
wow
BinaryByter
thanks internet for not telling me
BinaryByter
HI
BinaryByter
Holy shit
BinaryByter
you can bind class members to pointers
Satan
You're talking to urself or what? 😂😂😂
BinaryByter
i'm impressed at C++ :D
Satan
Me too
BinaryByter
I love C++
Bader
Bader
😂😂
Defragmented
i write in webgl - its actually c-like. nostalgia =) usually i write in js now...
Anonymous
uj
Ariana
Ariana
Entire section of extended C
BinaryByter
Anonymous
/
Onur
template<typename iter>
uint32_t read_u32(iter& begin)
{
static_assert(sizeof(unsigned char) == sizeof(std::iterator_traits<iter>::value_type));
return (uint32_t) (
*(begin++) << 24 |
*(begin++) << 16 |
*(begin++) << 8 |
*(begin++)
);
}
is this code correct way to read a 32 bit unsigned int from iterator of bytes?
BinaryByter
Onur
what would you prefer? unsigned char* ?
BinaryByter
you should just use a container that contains a uint32_t
BinaryByter
that way you don't need to do tedious conversions
BinaryByter
but obviously, I don't know your context
Onur
I get all data as array of bytes
Satyam
Satyam
Halo ppl
BinaryByter
Onur
it is a java class file
Onur
I am trying to make a toy jvm
BinaryByter
Oh
BinaryByter
jvm is a bytecode interpreter
BinaryByter
you should make a class that converts an iterator into a number
BinaryByter
like class iterator_to_uint32
BinaryByter
it takes an iterator and stores a number
Onur
I see but this part is before bytecode interpretetion
BinaryByter
BinaryByter
that's what I said
Onur
I have structs that are similar to jvm spesification
Onur
I am reading data and parsing them to these classes
BinaryByter
yea
BinaryByter
but iirc, it only specifies single byte-opcodes
Onur
Unfortunately I didn't come to that part yet. First I am trying to get a working class parser.
Onur
Then I will look to interpretation
BinaryByter
start by sequencing ALL of the token
BinaryByter
make them become little enum-elements
Onur
you mean opcodes?
BinaryByter
no
BinaryByter
break the opcodes into tokens