# ce_stage(..) == 2?

2 messages from 2010-02-15 to 2010-02-15. Participants: cg, Junio C Hamano.
Thread: https://gitlist.dev/t/22661

## cg, 2010-02-15 06:48

Subject: ce_stage(..) == 2?
Message-ID: <4B78EE4B.2040707@gmail.com>
URL: https://gitlist.dev/e/4B78EE4B.2040707%40gmail.com

```
Hi,

I  saw some code like:
attr.c(365): if (ce_stage(istate->cache[i]) == 2)
...
rerere.c(352):  if (ce_stage(e2) == 2
...

but there is no 0x200 in cache.h(158):
#define CE_NAMEMASK  (0x0fff)
#define CE_STAGEMASK (0x3000)
#define CE_EXTENDED  (0x4000)
#define CE_VALID     (0x8000)
#define CE_STAGESHIFT 12

so what does "2" mean?

Thanks
cg

```

## Junio C Hamano, 2010-02-15 06:53

Subject: Re: ce_stage(..) == 2?
Message-ID: <7vbpfrhtw1.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vbpfrhtw1.fsf%40alter.siamese.dyndns.org
In-Reply-To: <4B78EE4B.2040707@gmail.com>

```
cg <chengang31@gmail.com> writes:

> I  saw some code like:
> attr.c(365): if (ce_stage(istate->cache[i]) == 2)
> ...
> rerere.c(352):  if (ce_stage(e2) == 2
> ...
>
> but there is no 0x200 in cache.h(158):
> #define CE_NAMEMASK  (0x0fff)
> #define CE_STAGEMASK (0x3000)
> #define CE_EXTENDED  (0x4000)
> #define CE_VALID     (0x8000)
> #define CE_STAGESHIFT 12
>
> so what does "2" mean?

#define ce_stage(ce) ((CE_STAGEMASK & (ce)->ce_flags) >> CE_STAGESHIFT)

0x3000 shifted 12 places is a mask for two bits, as you can have cache
entries at stage 0 (normal), or stage 1/2/3.

```
