Sponsored Content
Full Discussion: Bit field issues in Linux
Top Forums Programming Bit field issues in Linux Post 302070825 by DreamWarrior on Friday 7th of April 2006 06:45:41 PM
Old 04-07-2006
OK...I found out that bitfields aren't guarenteed to be packed in any way. Its implementation defined and so I'm screwed Smilie. That sucks too because it'd otherwise be such an elegant solution. I wonder why the specification left it open, if it were guarenteed it'd make doing bit manipulation so much easier than forcing me to manually mask off everything.
 

8 More Discussions You Might Find Interesting

1. Gentoo

compiling 32 bit application on 64 bit linux(x86_64)

hi all, i have a 64 bit linux machine. $uname -a Linux SVRDELLD30 2.6.9-42.ELsmp #1 SMP Tue Aug 15 10:35:26 BST 2006 x86_64 x86_64 x86_64 GNU/Linux here by default gcc creates 64 bit executable. but for some reason i want to create 32bit executable. first i want to create 32 bit object... (3 Replies)
Discussion started by: uttamhoode
3 Replies

2. Red Hat

boot the 32 bit kernel on a 64 bit PPC Linux machine?

Hi all, I'm looking to cover a corner case for an upcoming test cycle. Is there a way to boot a RedHat Advanced Server 4 (update 3) installed on a Power PC machine to use a 32 bit kernel? This would be similar to what is done here -> https://www.unix.com/aix/26204-aix-platform.html I've done... (0 Replies)
Discussion started by: philrau
0 Replies

3. Red Hat

Installing orca in Linux 5.2 64 bit

Hello All, We have a new project in place that calls for RHEL 5.2 64 bit version. This is our first 5.2 as well as 64 bit exposure. On our other Solaris and RHEL 4 systems we used a stats gathering software called ORCA. We are running into problems however trying to install it on RHEL 5.2 64... (0 Replies)
Discussion started by: dchitus
0 Replies

4. Red Hat

32bit Linux vs 64 bit Linux

Friends , Would u plz tell me what is the difference between 32-bit Linux o/s and the 64 bit Linux o/s . Is there any RAM limitation in this two types of o/s . Waiting for kind reply ... ... (7 Replies)
Discussion started by: shipon_97
7 Replies

5. UNIX for Advanced & Expert Users

migrating unix mp-ras 32 bit to linux suse 64 bit

Hi. I need to migrate the whole unix environment from a Unix mp-ras 32 bit to a Linux Suse 64 bit. 1) can i use cpio to copy the data? 2) can i just copy the users from unix to linux or do i have to create them by hand 3) are there any other concerns i should worry about? thanx (1 Reply)
Discussion started by: mrodrig
1 Replies

6. Windows & DOS: Issues & Discussions

Windows 7 64 bit issues with X11

Hi, I was hoping that somebody could assist me with the following issue. I recently installed a windows 7 64 bit professional on a desktop with following specs: Intel Core i7 3.4Ghz, 16 GB DDR3 RAM, AMD Radeon HD 6450. (Which was a upgrade of a xp 32 bit based system) Since I'm more... (10 Replies)
Discussion started by: kristofvdo
10 Replies

7. High Performance Computing

AVX for Linux (32-bit)

For Intel processors we've a lot of new instruction sets (AVX and AVX2 already exists, AVX512 is announced). Therefore an application has to check during run time which instruction sets are available. I've written for that purpopse some procedures, which are callable from C or C++. A strange... (2 Replies)
Discussion started by: GG2014
2 Replies

8. Programming

SQL issues comparing Long field to sysdate

I am having hard time with this sql: select partition_name, high_value FROM user_tab_partitions WHERE table_name = 'WNP_TPRESPONSE_INSTANCE' and to_char(high_value) <= to_char(sysdate - 15, 'yyyymm') ; I get an error: ORA-00932: inconsistent datatypes: expected CHAR got LONG... (1 Reply)
Discussion started by: mrn6430
1 Replies
BITS(3) 						   BSD Library Functions Manual 						   BITS(3)

NAME
__BIT, __BITS, __SHIFTIN, __SHIFTOUT, __SHIFTOUT_MASK -- macros for preparing bitmasks and operating on bit fields SYNOPSIS
#include <sys/param.h> #include <sys/cdefs.h> uintmax_t __BIT(n); uintmax_t __BITS(m, n); __SHIFTIN(v, mask); __SHIFTOUT(v, mask); __SHIFTOUT_MASK(mask); DESCRIPTION
These macros prepare bitmasks, extract bitfields from words, and insert bitfields into words. A ``bitfield'' is a span of consecutive bits defined by a bitmask, where 1s select the bits in the bitfield. Use __BIT() and __BITS() to define bitmasks: __BIT(n) Return a bitmask with bit n set, where the least significant bit is bit 0. __BITS(m, n) Return a bitmask with bits m through n, inclusive, set. It does not matter whether m > n or m <= n. The least significant bit is bit 0. __SHIFTIN(), __SHIFTOUT(), and __SHIFTOUT_MASK() help read and write bitfields from words: __SHIFTIN(v, mask) Left-shift bits v into the bitfield defined by mask, and return them. No side-effects. __SHIFTOUT(v, mask) Extract and return the bitfield selected by mask from v, right-shifting the bits so that the rightmost selected bit is at bit 0. No side-effects. __SHIFTOUT_MASK(mask) Right-shift the bits in mask so that the rightmost non-zero bit is at bit 0. This is useful for finding the greatest unsigned value that a bitfield can hold. No side-effects. Note that __SHIFTOUT_MASK(m) = __SHIFTOUT(m, m). EXAMPLES
The following example demonstrates basic usage of the bits macros: uint32_t bits, mask, val; bits = __BITS(2, 3); /* 00001100 */ mask = __BIT(2) | __BIT(3); /* 00001100 */ val = __SHIFTIN(0x03, mask); /* 00001100 */ val = __SHIFTOUT(0xf, mask); /* 00000011 */ SEE ALSO
bitops(3), cdefs(3) HISTORY
The bits macros first appeared in atw(4), with different names and implementation. In their current form these macros appeared in NetBSD 4.0. AUTHORS
The bits macros were written by David Young <dyoung@NetBSD.org>. Matt Thomas <matt@NetBSD.org> suggested important improvements to the implementation, and contributed the macro names SHIFTIN() and SHIFTOUT(). BUGS
__BIT() and __BITS() can only express 32-bit bitmasks. BSD
October 17, 2012 BSD
All times are GMT -4. The time now is 04:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy