This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] bitmap_allocator.


Dhruv Matani wrote:

Of course sizeof(long) is 4 on 32-bit machines and that's ok, because, as I already wrote, 2 * sizeof(long) gives you the optimal alignment everywhere. And of course a builtin for long works for long, whatever size it has on that target.


Ok, what I shall do is create a typedef _Bitmap_t and make it equal to
long. That should do well. And then, we can later change that typedef so
that it can be converted to long long or something else that we want. In
general, the various size requirements will then be derived from
sizeof(_Bitmap_t). Is that fine with you?


I don't think you can do something fully general, as far as builtins are involved,
at least. And remember that long long is 8 bytes, not more, on 64-bit machines:
again, I suggest simply pairing longs in memory for higher alignment; on the
other hand longs are ok everywhere for the various quantities. Also, be careful
with the beginning of the usable memory block, which must have the same
alignment that we want for its elements: f.i., as I already told you, if there is
an header of sort perhaps padding might be needed, in general.


Take your time, no rush, this is scheduled for 4.0.0, which is still a few monts
away.


Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]