11-28-2011
can we compare the value in positions of the variables. For example break the bits and store in individual variables, and do the same with the second variable which is storing the other 16 bits.
ex 1010101010101010
break the value in to 16 variables so that
from right to left
var 0 = 0, var 1 = 1 var 2= 0 etc....till var 15
then
do the same with the second 16 bit binary
xvar 0 = 1 xvar 1 = 1 xvar 2 = 1
compare value
if var 0 = 0 and xvar 0 = 1 then result = 0..... store this in variable yvar 0
if var 1= 0 and xvar 1 = 1 then result = 0......store this in variable yvar 1
if var 2= 1 and xvar 2 = 0 then result = 0 ... store this in variable yvar 2
var [n] xvar[n] yvar[n]
so on till var 15
can anyone throw some light on doing this way.....
Thanks once again....
8 More Discussions You Might Find Interesting
1. Programming
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. Programming
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
3. UNIX for Advanced & Expert Users
can anybody write a program to divide a number by another number using bitwise operators (9 Replies)
Discussion started by: areef4u
9 Replies
4. Shell Programming and Scripting
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. Programming
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 &... (3 Replies)
Discussion started by: Puntino
3 Replies
6. FAQ Submission Queue
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
7. Shell Programming and Scripting
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
8. Shell Programming and Scripting
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
LEARN ABOUT PHP
apc_store
APC_STORE(3) 1 APC_STORE(3)
apc_store - Cache a variable in the data store
SYNOPSIS
bool apc_store (string $key, mixed $var, [int $ttl])
DESCRIPTION
array apc_store (array $values, [mixed $unused = NULL], [int $ttl])
Cache a variable in the data store.
Note
Unlike many other mechanisms in PHP, variables stored using apc_store(3) will persist between requests (until the value is removed
from the cache).
PARAMETERS
o $key
- Store the variable using this name. $keys are cache-unique, so storing a second value with the same $key will overwrite the
original value.
o $var
- The variable to store
o $ttl
- Time To Live; store $var in the cache for $ttl seconds. After the $ttl has passed, the stored variable will be expunged from the
cache (on the next request). If no $ttl is supplied (or if the $ttl is 0), the value will persist until it is removed from the
cache manually, or otherwise fails to exist in the cache (clear, restart, etc.).
o $values
- Names in key, variables in value.
RETURN VALUES
Returns TRUE on success or FALSE on failure. Second syntax returns array with error keys.
EXAMPLES
Example #1
A apc_store(3) example
<?php
$bar = 'BAR';
apc_store('foo', $bar);
var_dump(apc_fetch('foo'));
?>
The above example will output:
string(3) "BAR"
SEE ALSO
apc_add(3), apc_fetch(3), apc_delete(3).
PHP Documentation Group APC_STORE(3)