question for _ENDPOINT_G(e) - Minix

This is a discussion on question for _ENDPOINT_G(e) - Minix ; in include/minix/endpoint.h, there is a line: #define _ENDPOINT_G(e) (((e)+NR_TASKS) / _ENDPOINT_GENERATION_SIZE) I doubt whether "+NR_TASKS" here is necessary ? Because e is generated by, #define _ENDPOINT(g, p) ((g) * _ENDPOINT_GENERATION_SIZE + (p)) Which means _ENDPOINT_G(e) is, (((g) * _ENDPOINT_GENERATION_SIZE + ...

1. question for _ENDPOINT_G(e)

in include/minix/endpoint.h, there is a line:

I doubt whether "+NR_TASKS" here is necessary ?

Because e is generated by,
#define _ENDPOINT(g, p) ((g) * _ENDPOINT_GENERATION_SIZE + (p))

Which means _ENDPOINT_G(e) is,
(((g) * _ENDPOINT_GENERATION_SIZE + (p)+NR_TASKS) /
_ENDPOINT_GENERATION_SIZE)
equals to,

Here ((p) + NR_TASKS)/_ENDPOINT_GENERATION_SIZE always is 0.

So I just doubt whether it's necessary to add NR_TASKS to e to get
generation number ?

#define _ENDPOINT_G(e) ((e) / _ENDPOINT_GENERATION_SIZE) ?

If there is any mistaken, please tell me.

Thanks.

Coly

2. Re: question for _ENDPOINT_G(e)

On 1月26日, 下午4时46分, colyli wrote:
> in include/minix/endpoint.h, there is a line:
> #define _ENDPOINT_G(e) (((e)+NR_TASKS) / _ENDPOINT_GENERATION_SIZE)
>
> I doubt whether "+NR_TASKS" here is necessary ?
>
> Because e is generated by,
> #define _ENDPOINT(g, p) ((g) * _ENDPOINT_GENERATION_SIZE + (p))
>
> Which means _ENDPOINT_G(e) is,
> (((g) * _ENDPOINT_GENERATION_SIZE + (p)+NR_TASKS) /
> _ENDPOINT_GENERATION_SIZE)
> equals to,
> (g) + ((p) + NR_TASKS)/_ENDPOINT_GENERATION_SIZE
>
> Here ((p) + NR_TASKS)/_ENDPOINT_GENERATION_SIZE always is 0.
>
> So I just doubt whether it's necessary to add NR_TASKS to e to get
> generation number ?
>
> #define _ENDPOINT_G(e) ((e) / _ENDPOINT_GENERATION_SIZE) ?