G
grishin-mailing-lists
Hi there,
Dann Corbit's coding encouraged me to dig deeper into it.
I preprocessed something and found this
typedef signed int Etype;
count[((((Etype)*(a + i)-(Etype)(-2147483647 -1)) >>
(((8)*((sizeof(Etype))))-((w)+1)*(8))) & ((1 << (8))-1)) + 1]++; (1)
It's a part of radix most significant digit sort
which I've been trying to understand.
Well, variable a is known as Etype*, allright.
Part of statement (1):
( (Etype)*(a + i) - (Etype) (-2147483647 -1) )
this is usual casting
(Etype) (-2147483647 -1)
but what is that
(Etype)*(a + i) ?
I thought it was a peculiarities of preprocessing and wrote a program
to test this:
#include <stdio.h>
int main(void)
{
/*TASK: to find out is it possible to implement casting like
(type *) var
this way
(type)*(var)
Is that correct syntax?
ANSWER: they aren't equal.
*/
int i;
int *p;
int z = 1;
p = &i;
z = (int)*(p);
printf("%p\n", p);
printf("%d\n", z);
z = (int)p;
printf("%d\n", z);
return 0;
}
I:\prj\_Unleashed_C\ch13>a
0022FF54
0
2293588
They are different!
Well, what is (Etype)*(a + i) for?
Dann Corbit's coding encouraged me to dig deeper into it.
I preprocessed something and found this
typedef signed int Etype;
count[((((Etype)*(a + i)-(Etype)(-2147483647 -1)) >>
(((8)*((sizeof(Etype))))-((w)+1)*(8))) & ((1 << (8))-1)) + 1]++; (1)
It's a part of radix most significant digit sort
which I've been trying to understand.
Well, variable a is known as Etype*, allright.
Part of statement (1):
( (Etype)*(a + i) - (Etype) (-2147483647 -1) )
this is usual casting
(Etype) (-2147483647 -1)
but what is that
(Etype)*(a + i) ?
I thought it was a peculiarities of preprocessing and wrote a program
to test this:
#include <stdio.h>
int main(void)
{
/*TASK: to find out is it possible to implement casting like
(type *) var
this way
(type)*(var)
Is that correct syntax?
ANSWER: they aren't equal.
*/
int i;
int *p;
int z = 1;
p = &i;
z = (int)*(p);
printf("%p\n", p);
printf("%d\n", z);
z = (int)p;
printf("%d\n", z);
return 0;
}
I:\prj\_Unleashed_C\ch13>a
0022FF54
0
2293588
They are different!
Well, what is (Etype)*(a + i) for?