Use RC_SPAN_HEIGHT_BITS when setting the bitfield size of smin and smax in rcSpan.

This commit is contained in:
Graham Pentheny 2015-01-31 17:18:02 -05:00
parent 2ab396857b
commit df6fac219b

View File

@ -245,7 +245,7 @@ struct rcConfig
/// Defines the number of bits allocated to rcSpan::smin and rcSpan::smax.
static const int RC_SPAN_HEIGHT_BITS = 13;
/// Defines the maximum value for rcSpan::smin and rcSpan::smax.
static const int RC_SPAN_MAX_HEIGHT = (1<<RC_SPAN_HEIGHT_BITS)-1;
static const int RC_SPAN_MAX_HEIGHT = (1 << RC_SPAN_HEIGHT_BITS) - 1;
/// The number of spans allocated per span spool.
/// @see rcSpanPool
@ -255,10 +255,10 @@ static const int RC_SPANS_PER_POOL = 2048;
/// @see rcHeightfield
struct rcSpan
{
unsigned int smin : 13; ///< The lower limit of the span. [Limit: < #smax]
unsigned int smax : 13; ///< The upper limit of the span. [Limit: <= #RC_SPAN_MAX_HEIGHT]
unsigned int area : 6; ///< The area id assigned to the span.
rcSpan* next; ///< The next span higher up in column.
unsigned int smin : RC_SPAN_HEIGHT_BITS; ///< The lower limit of the span. [Limit: < #smax]
unsigned int smax : RC_SPAN_HEIGHT_BITS; ///< The upper limit of the span. [Limit: <= #RC_SPAN_MAX_HEIGHT]
unsigned int area : 6; ///< The area id assigned to the span.
rcSpan* next; ///< The next span higher up in column.
};
/// A memory pool used for quick allocation of spans within a heightfield.