[Development] QDateTime is missing shared null optimization

Mark Langezaal mark.langezaal at xs4all.nl
Mon Aug 3 03:23:44 CEST 2015


On 2015-08-01 23:51, Thiago Macieira wrote:

> QDateTime API accepts the offset from UTC in seconds, but all existing
> timezones are multiples of a quarter hour. With a range from -12 to 
> +13.5,  we
> need ceil(log((13.5 + 12) * 4) / log(2)) = 7 bits for the timezone. 
> With the
> one bit for the tag, we have 48 bits left for the msecs portion on 
> 64-bit
> platforms.
> 
> A 48-bit millisecond field spans 3257812 days. JD 3257812 is 
> 4207-06-27.

Actually you used 1 + 7 + 48 = 56 bits, which leave another 8 bits for 
useful data such as Spec. Or am I missing something obvious here?
What is the recommended way to share a d-ptr with other data? By using a 
union on the d-ptr and a struct containing bit fields?

> Anyone want to try this?
> 
> Please note you cannot manipulate the this pointer in a member 
> function, so
> all the QDateTimePrivate member functions need to be made static first.

Regards,
Mark Langezaal



More information about the Development mailing list