lol gcc > mingw
Type: Posts; User: andydufresne
lol gcc > mingw
Thanks guys. Weird thing is that mingw will compile:
int a[4];
a = {1,2,3,4};
but gcc 4.7 won't. Is there a bug with mingw that is allowing me to do this?
I know I can do this:
int a[4] = {1,2,3,4};
but I want to do this:
int a[4];
Ah, thank you! I though I'd found some way of making my program much more efficient! BTW are there any suggestions you'd make about improving the performance of the substantive code?
Ah the answer seems to be that I was optimising for speed and when the data is staying the same it makes it faster.
Both pieces of code are identical except for where charstate is copied from. The lookup functions are executed in both.
Sorry, I find it a little difficult to understand you. From the my above post is it clear why one piece of code is much faster? Is it, as I may think, that for the original piece of code the 2d array...
Ok, here is the original code looped from main 500000 times. It took 400 ms.
void applymixcolumns (unsigned char charstate[][4],unsigned char multmatrix[][4])
{
The difference between when I copy from test to charstate compared to tempstate to charstate is about 3* longer. The thing is that the stuff in between is happening anyway. The only think I'm...
I still don't think you need it but here it is anyway:
void applymixcolumns (unsigned char charstate[][4],unsigned char multmatrix[][4])
{
The reason I need tempstate is that the function continually changes the 2d array and the operations performed depend on the original version of the 2d array.
Tried to memcpy to no effect.
Urgh. The second piece of code is much faster.
This is my actual code:
void applymixcolumns (unsigned char charstate[][4],unsigned char multmatrix[][4])
{
Thanks for the reply but I'm confused why this code is much much quicker :
unsigned char test[4][4];
//recopy temp into charstate
So I have a function which takes in a 2d array as a parameter and sets its value by copying another (locally declared) 2d array like this (both 2d arrays of unsigned chars):
for (int...
I've been implementing the aes algorithm. It works fine in theory (block encryption and decryption) but I'm struggling to use it to encrypt files. The block is composed of 16 by 16 unsigned chars (as...
Ah, of course.
Do you have any ideas about the best way of splitting up the message into chunks <n ?
Thanks!
I'm trying to implement the RSA algorithm (just for fun, with no padding). My code works fine encrypting up to 83 characters but after this the decryption output is only gibberish and (no matter the...
Ah, sorry about that. Still doesn't work with mpf_mul_ui (x,x,2);
HI everyone,
I'm trying to make a program to compute pi to n places. I'm using the Gauss Legendre (Gauss-Legendre Algorithm -- from Harry J. Smith).
I'm using the GMP MP package for arbitrary...