Sponsored Content
Full Discussion: bit manipulation
Top Forums Programming bit manipulation Post 302716129 by Don Cragun on Tuesday 16th of October 2012 03:34:48 AM
Old 10-16-2012
There is certainly no reason to #define TI_ZN to two different values (unless there are conditional tests to choose one setting over another based on the compilation environment) unless you're trying to confuse someone reading your source code.

Sometimes it makes sense when defining masks for bit fields or defining various parts of a value that contains bit fields to make it easier to understand the individual fields being set. For example you might find something like:
Code:
/* File type */
#define S_IFMT          (017<<12)         /* file type mask */
#define S_IFIFO         (001<<12)         /* named pipe (fifo) */
#define S_IFCHR         (002<<12)         /* character special */
#define S_IFDIR         (004<<12)         /* directory */
#define S_IFBLK         (006<<12)         /* block special */
#define S_IFREG         (010<<12)         /* regular */
#define S_IFLNK         (012<<12)         /* symlink */
#define S_IFSOCK        (014<<12)         /* socket */

on some systems in <sys/stat.h>.
This User Gave Thanks to Don Cragun For This Post:
 

5 More Discussions You Might Find Interesting

1. Programming

copying or concatinating string from 1st bit, leaving 0th bit

Hello, If i have 2 strings str1 and str2, i would like to copy/concatenate str2 to str1, from 1st bit leaving the 0th bit. How do i do it? (2 Replies)
Discussion started by: jazz
2 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. 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

4. Shell Programming and Scripting

How to handle 64 bit arithmetic operation at 32 bit compiled perl interpreter?H

Hi, Here is the issue. From the program snippet I have Base: 0x1800000000, Size: 0x3FFE7FFFFFFFF which are of 40 and 56 bits. SO I used use bignum to do the math but summing them up I always failed having correct result. perl interpreter info, perl, v5.8.8 built for... (0 Replies)
Discussion started by: rrd1986
0 Replies

5. Windows & DOS: Issues & Discussions

Which version of Windows Vista to install with a product key? 32-bit or 64-bit?

Hello everyone. I bought a dell laptop (XPS M1330) online which came without a hard drive. There is a Windows Vista Ultimate OEMAct sticker with product key at the bottom case. I checked dell website (here) for this model and it says this model supports both 32 and 64-bit version of Windows... (4 Replies)
Discussion started by: milhan
4 Replies
scsi_find_sense_descr(9F)				   Kernel Functions for Drivers 				 scsi_find_sense_descr(9F)

NAME
scsi_find_sense_descr - find descriptor in SCSI sense data SYNOPSIS
#include <sys/scsi/scsi.h> uint8_t *scsi_find_sense_descr(uint8_t *sense_buffer, int sense_buf_len, int req_descr_type); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). PARAMETERS
sense_buffer Pointer to a buffer containing SCSI descriptor sense data. The data is expected in wire format starting at the response code. sense_buf_len Integer that contains the length of sense buffer in bytes. req_descr_type Integer that contains the descriptor type value for the desired sense descriptor. DESCRIPTION
The scsi_find_sense_descr() function is used to obtain a pointer to a specific descriptor type, specified by req_descr_type, within a descriptor sense buffer. Before returning the pointer, scsi_find_sense_descr() verifies that the entire descriptor is present based on the length provided in sense_buf_len. Any value for req_descr_type can be requested. The following descriptor types are already defined: #define DESCR_INFORMATION 0x00 #define DESCR_COMMAND_SPECIFIC 0x01 #define DESCR_SENSE_KEY_SPECIFIC 0x02 #define DESCR_FRU 0x03 #define DESCR_STREAM_COMMANDS 0x04 #define DESCR_BLOCK_COMMANDS 0x05 #define DESCR_OSD_OID 0x06 #define DESCR_OSD_RESP_INTEGRITY 0x07 #define DESCR_OSD_ATTR_ID 0x08 Drivers should use scsi_validate_sense(9F) to ensure that the sense buffer contains valid descriptor sense data. RETURN VALUES
The scsi_find_sense_descr() function returns a pointer to a sense descriptor of the requested type if a descriptor of that type exists. If no such descriptor exists, scsi_find_sense_descr() returns NULL. CONTEXT
The scsi_find_sense_descr() function can be called from user or interrupt context. SEE ALSO
scsi_ext_sense_fields(9F), scsi_sense_asc(9F), scsi_sense_ascq(9F), scsi_sense_cmdspecific_uint64(9F), scsi_sense_info_uint64(9F), scsi_sense_key(9F), scsi_validate_sense(9F) SunOS 5.11 30 Jun 2006 scsi_find_sense_descr(9F)
All times are GMT -4. The time now is 09:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy