LL_ macros and nsInt64 considered deprecated

4 views
Skip to first unread message

Darin Fisher

unread,
Feb 22, 2006, 6:39:58 PM2/22/06
to dev-te...@lists.mozilla.org, dev-tec...@lists.mozilla.org
If you are using the LL_ macros to perform 64-bit integer arithmetic,
don't bother. NSPR already requires native compiler support for int64
types, so there isn't much point to the LL_ macros any longer. These
are the macros defined in prlong.h, such as LL_ADD and LL_MUL.

Also, if you are working above NSPR in the Mozilla codebase, I suggest
that you treat nsInt64 and nsUint64 as deprecated classes. Just use
PRInt64/PRUint64 directly.

Cheers,
-Darin

Wan-Teh Chang

unread,
Feb 22, 2006, 9:47:36 PM2/22/06
to
The LL_ macros are a pain to use. They also
make the code hard to understand.

Two or three years ago, we observed that all
the compilers that NSPR supported had 64-bit
integer types. We also learned that C99 made
the common language extension 'long long', which
is at least 64-bit, officially a part of the C
language.

Now, in 2006, we think the time is right to
assume that all the compilers that NSPR supports
have 64-bit integer types, and to allow new
code to use PRInt64 and PRUint64 variables
freely in normal arithmetic expressions.

There is, however, a complication. The
suffices for 64-bit integer constants aren't
LL and ULL under all compilers. The main
exception is older versions of Microsoft
Visual C++, which use the i64 and ui64
suffices. prlong.h defines an LL_INIT
macro that you can use on constants used
as initializers. The LL_INIT macro can't
be used elsewhere. So it seems that we
should add new PR_INT64 and PR_UINT64 macros
to prtypes.h, similar to the PR_INT32 and
PR_UINT32 macros.

Wan-Teh

Darin Fisher

unread,
Feb 23, 2006, 12:08:10 AM2/23/06
to Wan-Teh Chang, dev-te...@lists.mozilla.org
On 2/22/06, Wan-Teh Chang <wtc...@redhat.com> wrote:
> The LL_INIT macro can't
> be used elsewhere. So it seems that we
> should add new PR_INT64 and PR_UINT64 macros
> to prtypes.h, similar to the PR_INT32 and
> PR_UINT32 macros.

That sounds like a great idea to me.

-Darin

Reply all
Reply to author
Forward
0 new messages