473,382 Members | 1,086 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

64 bit register manipuate using 1ULL << (a) macro?


If I have set a macro such like:

#define BIT(a) (1ULL << (a))

will something like
*(u64*)REGISTER1 |= BIT(53)
work if i wanna set bit[53] as 1 ?

I'm running on MIPS which have several 64bit registers,
just don't know if the syntax will work.

thanks for any idea.

Apr 25 '06 #1
2 9429
timmu wrote:

If I have set a macro such like:

#define BIT(a) (1ULL << (a))

will something like
*(u64*)REGISTER1 |= BIT(53)
work if i wanna set bit[53] as 1 ?

I'm running on MIPS which have several 64bit registers,
just don't know if the syntax will work.

thanks for any idea.


Looks OK to me.

#define BIT(a) (1ULL << (a))

#define READ_BIT(U, N) ((U) >> (N) & 1ULL)
#define SET_BIT(U, N) ((void)((U) |= BIT(N)))
#define CLEAR_BIT(U, N) ((void)((U) &= ~BIT(N)))
#define FLIP_BIT(U, N) ((void)((U) ^= BIT(N)))

--
pete
Apr 25 '06 #2
On 25 Apr 2006 03:06:11 -0700, "timmu" <ti****@gmail.com> wrote:

If I have set a macro such like:

#define BIT(a) (1ULL << (a))

will something like
*(u64*)REGISTER1 |= BIT(53)
work if i wanna set bit[53] as 1 ?
Assuming you want little-endian bit numbering, u64 is a typedef for a
sufficiently large (presumably 64-bit) unsigned type, and REGISTER1 is
(or evalutes to) a pointer to something that is large enough and
correctly aligned to hold a u64, yes.
I'm running on MIPS which have several 64bit registers,
just don't know if the syntax will work.

If you mean processor registers, it is extremely rare to be able to
have a pointer to one of those. (There are some odd architectures
which do this, but MIPS is not one of them.) On modern compilers it's
rarely possible to assign a variable to a particular or known
register, or even to any register, but if you can and do for a
variable of type u64 then just x |= BIT(53).

- David.Thompson1 at worldnet.att.net
May 4 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Ian Rastall | last post by:
I'm curious as to the group's feelings about using the <fieldset> and <legend> tags around elements other than <form> elements ... I wrote a small test file:...
5
by: toylet | last post by:
Attached is some css codes for a website. It has 3 parts: top-bar, side-bar (on the left) and main-body. The top-bar has a mouseover menu called top-menu implemented via ul:hover. When the mouse...
8
by: rong.guo | last post by:
Greetings! I am now doing one type of analysis every month, and wanted to creat table names in a more efficient way. Here is what happens now, everytime I do the analysis, I will create a...
3
by: Jeff Marcum | last post by:
I have a database set-up to do file comparisons. I import the files into the database and do the comparisons with queries. I have to do this comparison on a daily basis so I would like to set up...
3
by: bwhite | last post by:
I have a temp table with one row of data that I need to export into Excel. I created the export to create the xls file as follows ... Dim FileName FileName = !! DoCmd.SetWarnings False...
6
by: lgn | last post by:
I have test the following program, why the result is not 0 2 4 but 0 2 3? Can someone tell me why the same macro produce different result? Thanks! #include <stdio.h> #define max(a,b) ((a)>(b) ?...
1
by: shinde.shailesh | last post by:
Hi All, I have an xls file which contains data in one column. Also Having .MDB file with Table name "TableTest" and one field "Tabletst". I ahve to extract data from xls to MDB using Macro. ...
2
by: musa.biralo | last post by:
Hi, i want to read each row of specific column of musa.dbf using macro (VBA) in excel. my main gole is to copy the data of dbf file to excel file. I am new but want to do something..i tried and...
1
by: John | last post by:
Hi var poster="<html><head..... etc .... </html>"; var animal='dog'; The string contains images and text that changes. Originally I wanted to do something like print "<a href=" +...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.