"Jerry" <> writes:
> The situation is such:
> We are processing a project porting products on Windows platform to
> Mac. OS.,and,we are not familar with Mac.so there are always some
> troublesome things bother us.
> Today my partner want a QWORD data type and want to use 'sturct' to
> difine QWORD variables,and,do artithmetics operations with such
> variables.
> I remember that there are methods that can do this just using BitwiSe
> operation.
I'm not sure how big a QWORD is, but if you want to implement, say,
128-bit arithmetic on a system that only supports 64-bit arithmetic,
bitwise operators are not the best approach. For addition, for
example, it's going to be a lot easier to use addition on the lower
and upper halves with a little extra code to handle carries. The
technique is well known (but I don't know the details).
I'm sure it's possible using just bitwise operators, but it's going to
be slow, difficult, and error-prone.
(If a QWORD is 64 bits, there's a good chance your compiler supports
it directly, probably as "long long".)
--
Keith Thompson (The_Other_Keith)
kst- <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.