weird (numleafs+31)>>3 in SV_FatPVS
Moderator: InsideQC Admins
3 posts
• Page 1 of 1
weird (numleafs+31)>>3 in SV_FatPVS
This is a bug/typo, right?
https://github.com/id-Software/Quake/bl ... ain.c#L412
That gives the number of bytes for the bitvector, plus 3 bytes padding, which seems useless.
It should just be (numleafs+7)>>3 like all of the other PVS buffers?
There are some occurences of:
in Quakeworld, which is rounding up to the nearest 4 byte boundary, so possibly that's where the typo came from.
- Code: Select all
fatbytes = (sv.worldmodel->numleafs+31)>>3;
https://github.com/id-Software/Quake/bl ... ain.c#L412
That gives the number of bytes for the bitvector, plus 3 bytes padding, which seems useless.
It should just be (numleafs+7)>>3 like all of the other PVS buffers?
There are some occurences of:
- Code: Select all
4*((sv.worldmodel->numleafs+31)>>5);
in Quakeworld, which is rounding up to the nearest 4 byte boundary, so possibly that's where the typo came from.
- ericw
- Posts: 92
- Joined: Sat Jan 18, 2014 2:11 am
Re: weird (numleafs+31)>>3 in SV_FatPVS
I think the intention is that it's to allow the following Q_memset to take it's fast path.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-
mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
Re: weird (numleafs+31)>>3 in SV_FatPVS
Yeah, I think it must have been an attempt to round up to the nearest multiple of 4, but even then it doesn't work as written:
>>> x = 12
>>> (x + 31) / 8
5
>>> x = 12
>>> (x + 31) / 8
5
- ericw
- Posts: 92
- Joined: Sat Jan 18, 2014 2:11 am
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest