Sponsored Content
Full Discussion: bitwise and if
Top Forums Programming bitwise and if Post 302189511 by Puntino on Saturday 26th of April 2008 04:10:33 AM
Old 04-26-2008
bitwise and if

Hi

Suppose we have these code lines:

#define _IN_USE 0x001 /* set when process slot is in use */
#define _EXITING 0x002 /* set when exit is expected */
#define _REFRESHING 0x004

...
1 main () {
2
3 unsigned r_flags =_REFRESHING;
4
5 if (r_flag & _IN_USE){
6 if (r_flag & _EXITING){
7 printf("EXITING");
8 }
9 if (r_flag & _REFRESHING){
10 printf("REFRESHING");
11 }
12 }
13 }

Will i see on the screen the string REFRESING ? (line 10)
Can I say that REFRESCHING and EXITING are two particular cases of the more generic IN_USE?
Than you in advance
 

10 More Discussions You Might Find Interesting

1. Programming

Bit-fields and Bitwise operators

Hi, Is it possible to use bitwise operators in bit fields? For example: typedef struct Mystruct { unsigned char A :1 ; unsigned char B :1 ; } Mystruct; and assume struct Mystruct STR_1S, STR_2S, tempSTRS = {0}; then the following line: tempSTRS = STR_1S & STR_2S; gives the... (3 Replies)
Discussion started by: amatsaka
3 Replies

2. UNIX for Advanced & Expert Users

bitwise operators

can anybody write a program to divide a number by another number using bitwise operators (9 Replies)
Discussion started by: areef4u
9 Replies

3. Programming

resetting counter using bitwise XOR

Hi ! How to reset a variable to 0 after a reset value, say 10 using bitwise XOR. For example, int cnt=0; if(cnt<10) cnt++; else cnt = 0; How can we achieve this by using XOR only. thanks, (1 Reply)
Discussion started by: mrgubbala
1 Replies

4. Shell Programming and Scripting

Bitwise negation

I am taking an online course on Unix scripting. The topic is Unix arithmetic operators and the lesson is Logical and bitwise operations. It is not clear how much storage space Unix uses to represent integers that are typed. Bitwise negation caused me to question how many bits are used to... (3 Replies)
Discussion started by: dLloydm
3 Replies

5. Shell Programming and Scripting

how to calculate netwrk from IP address and netmask using Bitwise AND in shell script

Hi, I am having two variables IP="10.150.12.1" netmask="255.255.255.0" To get network number, I know that a bitwise & will help. networkno=IP & netmask My code is #!/usr/bin/ksh ip="10.150.12.1" netmask="255.255.255.0" networkno="$ip" & "$netmask" echo $networkno I am... (7 Replies)
Discussion started by: chaitanyapn
7 Replies

6. Emergency UNIX and Linux Support

bitwise and between two 32 bit binaries

Hello All, i have two 16 bit binaries that in two different variables, i want to perform a bitwise AND between the two and store the result in a different variable. can anyone throw some light on doing this in a bourne shell... eg var1= 1110101010101011 ... (8 Replies)
Discussion started by: venu
8 Replies

7. FAQ Submission Queue

Analysis in bitwise XOR

The purpose of this article is revealing the unrevealed parts of the bitwise XOR. As we aware, the truth table for the XOR operator is : A B A^B 0 0 0 0 1 1 1 0 1 1 1 0 For example , 1^2 will be calculated as given below: First the operands... (1 Reply)
Discussion started by: pandeesh
1 Replies

8. Shell Programming and Scripting

how to use bitwise or operator in /bin/sh

please any one can suggest me how to use bitesie || opearator to do this #initallize a=0 b=0 #condition if then a=0 else a=1 fi #bitwise or opeartion b = a || b Please view this code tag video for how to use code tags when posting code and data. (3 Replies)
Discussion started by: Palaniappan
3 Replies

9. Shell Programming and Scripting

Bitwise comparison of cols

Hello, I want to compute the bitwise number of matches in pairwise fashion for all columns. The problem is I have 18486955 rows and 750 columns. Please help with code, I believe this will take a lot of time, is there a way of tracking progress? Input Org1 Org2 Org3 A A T A ... (9 Replies)
Discussion started by: ritakadm
9 Replies

10. Programming

Bitwise operation for state machine

Hello All, I am writing basic state machine which maintains 8 different states and there is posibility that system may be in multiple states at a time (Except for state1 to state3. menas only once state can be active at a time from state1 to state3). I have declared... (9 Replies)
Discussion started by: anand.shah
9 Replies
HISAXCTRL(8)						    Linux System Administration 					      HISAXCTRL(8)

NAME
hisaxctrl - configure HiSax-Module SYNOPSIS
hisaxctrl DriverId command parameters DESCRIPTION
hisaxctrl is used to setup the HiSax-ISDN device driver. All logging-output is sent to the device /dev/isdnctrl. So you can show it by executing cat /dev/isdnctrl. NOTE: for devfs systems, the program will automatically use /dev/isdn/isdnctrl if available. The use of hisaxctrl only makes sense if you are using the HiSax driver. OPTIONS
DriverId is used to identify the card when using more than one passive card. While loading the hisax module with insmod, or modprobe the DriverId is set by appending id=idstring1%idstring2%... to the commandline. command is an integer selecting the setup category. The following values are defined for setting the logging-level of the HiSax-ISDN device driver: 0 reports card status infos. 1 selects generic debugging. 11 selects layer 1 development debugging. 13 selects layer 3 development debugging. the following commands are used to enable special features during runtime of the HiSax-ISDN device driver. 2 set B-channel ON delay to parameter (in ms) 5 set B-channel in leased mode 6 set B-channel in TESTLOOP mode 7 set/reset card in Point To Point mode 8 set card in FIXED TEI mode 9 load firmware for DSP cards 10 set B-channel usage limit to 1 or 2 channels 12 set echo logging mode (only for some cards) B-channel usage limit needs to be 1 if enabled parameter If the command is 9 then the parameter is the full pathname to the file containing the firmware. For debug settings this is an integer representing a bitmask. Every bit in this mask switches a debug facility on or off. Depending on the selected category, the following values are defined: With generic debugging selected (command 1): 0x001 Link-level <--> hardware-level communication 0x002 Top state machine 0x004 D-Channel Q.931 (call control messages) 0x008 D-Channel Q.921 0x010 B-Channel X.75 0x020 D-Channel l2 0x040 B-Channel l2 0x080 D-Channel link state debugging 0x100 B-Channel link state debugging 0x200 TEI debug 0x400 LOCK debug in callc.c 0x800 More debug in callc.c (not for normal use) With layer 1 development debugging selected (command 11): 0x001 Warnings (default: on) 0x002 IRQ status 0x004 ISAC 0x008 ISAC FIFO 0x010 HSCX 0x020 HSCX FIFO (attention: full B-Channel output!) 0x040 D-Channel LAPD frame types With layer 3 development debugging selected (command 13): 0x001 Warnings (default: on) 0x002 l3 protocol discriptor errors 0x004 l3 state machine 0x008 charge info debugging (1TR6) EXAMPLE
hisaxctrl HiSax 1 0x3ff enables full generic debugging. AUTHOR
(C) 2000 by Karsten Keil <kkeil@suse.de> SEE ALSO
isdnctrl(8), isdn_cause(7), isdninfo(4). isdn4k-utils-3.13 2001/08/09 HISAXCTRL(8)
All times are GMT -4. The time now is 10:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy