**left shift operator behaves like left rotate when the operand is a variable.**Below is a snippet of code and the result (compiler version also
mentioned). I fail to understand why the left shift operator behaves
as if it were the left rotate operator when the operand is a variable.
$ cat test.c
#include <stdio.h>
int main(void)
{
unsigned int a = 32, b = 33;
printf("with constants 1 << 32 = %u, 1 << 33 = %u\n", 1<<32,
1<<33);
printf("with variables 1 << 32 = %u, 1 << 33 = %u\n", 1<<a, 1<<b);
return 0;
}
$ gcc test.c
test.c: In function 'main':
test.c:6:5: warning: left shi...

**Left Shift / Right Shift Operators**Hi,
Is there any way to catch the losing bit occurring due to Right Shift
Operator ?
e.g
int a = 5 ;
a = a >> 1 ; // // a is now 2 and the least significant bit is lost //
//
I want this solution for the question:
"How to find if the number is even or odd using only "<<" or/and ">>"
operators ?"
On Thu, 29 Nov 2006, Santosh Nayak wrote:
>
> Is there any way to catch the losing bit occurring due to Right Shift
> Operator ?
int a = 5;
int lost_bit = a & 1;
a = a >> 1;
/* now lost_bit holds the lost bit */
> ...

**Java left shift and right shift operators.**I have a problem where I have to do left shift and right shift.
Long N;
int shiftby;
output = N >> shiftby;
Above N is shifted right.
Example if N=11101101 [binary value]
will become: 1110110 when shiftby=1;
will become: 0111011 when shiftby=2;
will become: 0011101 when shiftby=3;
will become: 0001110 when shiftby=4;
will become: 0000111 when shiftby=5;
will become: 0000011 when shiftby=6;
will become: 0000001 when shiftby=7;
When I want to shift left I can use
output = N << shiftby; //[Not change in sign "<<" instead of ">>"]
Above N is shi...

**Shift operator**Hi (again)!
Anyone knows how the vhdl shift operator (shr or shl) is implemented?
Ex: out_var := shr(inp_value,inp_shr);
Is it synthesized to a barrel shifter? I guess this requires a lot of
logic, anyone have a rough idea how much area/gates a 32-bit barrel
shifter needs? From the standard "triangle" layout, it looks like the
area grows with a factor 4, so that a 64-bit barrel shifter consumes 4
times as much hardware as a 32 bit. Anyone knows if this is correct?
Lots of questions... : )
Best regards,
Andreas Lundgren
...

**rotate operators**Hi,
Can I suggest using !>> and <<! for right and left rotate operations
respectively ?
Rob
"Robert Finch" <robfinch@sympatico.ca> wrote in message
news:F1_Md.4718$lw4.1016414@news20.bellglobal.com...
> Hi,
>
> Can I suggest using !>> and <<! for right and left rotate operations
> respectively ?
Suggest away. But this isn't really the best group
for that. The group where the C++ standard and its
future directions are discussed is comp.std.c++.
Here we try to keep the discussion about the language
in its current form.
-Mike
Ro...

**Shift operators.**If i'm shifting an integer 'n' times where n > sizeof(int), It's giving
the same value as
that of n-sizeof(n). Why is it behaving like this. I studied that the
bit 'll be replaced by '0'.
Example;
int i = 1;
printf ("%d\n", i<<32);
o/p: 1.
int i = 2;
printf ("%d\n", i<<33);
o/p: 2.
Le 14-06-2006, deepak <deepakpjose@gmail.com> a �crit�:
> If i'm shifting an integer 'n' times where n > sizeof(int), It's giving
> the same value as
> that of n-sizeof(n). Why is it behaving like this. I studied...

**Shift Operation**Hi All,
Could you please explain whether C standard supports logical right
shift operation using some operator?
I know somewhere I read about >>> operator. I thought, it is in C but i
think i'm wrong about it. No where google helps me determining this
lapse in my memory. MSVC 6 compiler gives me error.
Thanks && Regards,
Nishu
Nishu said:
> Hi All,
>
> Could you please explain whether C standard supports logical right
> shift operation using some operator?
C's right shift operator, >>, works like this:
A >> B will yield a result that is...

**Rotate operators**Hi all,
In xHarbour compiler there are left-shift(<<) and right-shift(>>) operators.
Very good. But in many implementations it can be usefull left-rotate and
right-rotate operators. Especially for data packing/crypting, because no
bit lossing occures.
Well known C compilers have not theese operators and users with assembler
practise in tears remember such good ROL and ROR assembler instructions.
What do you thing about this ?
With best regards,
also in tears
Saulius
Saulius
> In xHarbour compiler there are left-shift(<<) and right-shift(>>)
> operators.
...

**shift operator**hi all,
can anyone please tell me how to do a left shift in the folowing
manner.
suppose there are 5bits: 10010 now i have to shift left such that 1st
bit should go to the last position i.e 00101. when I use "<<" operator
the last position is appended with 0 i.e 00100. Is there any operator
in verilog to use?
Thanks a lot.
Regards,
Raghu
On 5 Jul 2006 00:08:24 -0700, "raghu" wrote:
>can anyone please tell me how to do a left shift in the folowing
>manner.
>suppose there are 5bits: 10010 now i have to shift left such that 1st
>bit sh...

**US-PA: Philadelphia-Computer Operator-Print Operator -night shift****************************************************************
JobCircle.com is the largest regional job board in the
Mid-Atlantic region, with tens of thousands of job offerings
in PA, NJ, DE, MD, NY, and Washington D.C. To learn more,
visit http://www.jobcircle.com?source=ng
**************************************************************
Job Title: Computer Operator-Print Operator -night shift
Job Location: PA: Philadelphia
Pay Rate: per Hour
Job Length: full time
Start Date: 2009-02-25
Company Name: Kforce Professional Staffing
Contact: John Vagie
Phone: ...

**problem with shift operation**I hav the follwoing simple code which does left shifting operation.
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
entity counter is
port (
q: inout STD_LOGIC_VECTOR (3 downto 0);
clock: in STD_LOGIC;
reset: in STD_LOGIC;
en: in STD_LOGIC
);
end counter;
architecture counter of counter is
signal count:std_logic_vector(3 downto 0):="0000";
begin
process(clock,reset)
begin
if reset='0' then
count<="0000";
elsif(clock='1') then
if en='1' then
l1: for i in 1 to 3 loop
...

**bitset rotational shift?**I need to do rotational shift on bitset. But I couldn't find that
operation in the standard. Is there any workaround or other packages to
do this?
Thanks,
Peng
In article <1143439864.704032.283850@i39g2000cwa.googlegroups.com>,
"PengYu.UT@gmail.com" <PengYu.UT@gmail.com> wrote:
> I need to do rotational shift on bitset. But I couldn't find that
> operation in the standard. Is there any workaround or other packages to
> do this?
You can do it the same way you would on an unsigned integral type (which
shifts):
#include <bitset>
#include <st...

**shift right operator**main()
{
int a =100;
a = a>>32;
printf(" %d", a);
}
it prints "a" as 100 only....but I am expecting a = 0.....
can some one tell me the reason?
bye
Deepak\
DeepaK K C wrote:
> main()
> {
> int a =100;
> a = a>>32;
> printf(" %d", a);
> }
>
> it prints "a" as 100 only....but I am expecting a = 0.....
> can some one tell me the reason?
It's a manifestation of undefined behaviour. (Some machines
only have a 5-bit shift count, for example.)
What happens if you turn your compiler warnings up?
--
Chris "...

**Rotate Matrix operator?**Dear all
has anybody handle such a strange transfer of matrix? like
1 2 3 operator?? 1 0 0
4 5 0 -------------> 4 2 0
6 0 0 6 5 3
it seems like to nip the first row vector as the diagonal
terms of new matrix, the second row also clockwise rotates
45 degree, and so on.. the rest triangle upper part are
taken to be zero. Maybe it is stupid, but if you know how to
make it or it does exist a command in Matlab, please let me
know.Thank you very much.
"william riker Tang" <williamriker.tang@gmail.com> wrote in
message <g1dmir$mqg$1@fred...

**Operation Blue Shift**http://ps-2.kev009.com/pccbbs/
250GB of RickE. Goes to 2008 or so.
Regards,
--
Kevin Bowling
Free Comp.* Usenet access at http://csiph.com/
On 3/1/2012 2:05 AM, Kevin Bowling wrote:
> http://ps-2.kev009.com/pccbbs/
>
> 250GB of RickE. Goes to 2008 or so.
>
> Regards,
I had some directory permissions wrong so most of the new stuff wasn't
even visible. This has been fixed.
--
Kevin Bowling
Free Comp.* Usenet access at http://csiph.com/
...

**phase shift and rotation**Hi to everyone,
I have a problem.
I need to traslate and rotate the phase spectrum of a
richer wave in order to see the differences of the wave in
the time domain.
I've done this multiplying the phase spectrum for a complex
exponential, but the result is wrong.
Someone knows the right formula?
Thanks
...

**PIL rotate : Rotate By Shear / Paeth Rotation?**I've been doing some image rotation with PIL and comparing the images
with imagemagick's convert -rotate output.
Imagemagick uses an RBS / Paeth rotation algorithm that appears to
give better results than PIL's rotate method.
However, I love PIL and don't want to have to shell out to imagemagick
or use it's python bindings if I can stay with my beloved Python
Imaging Library.
Has anyone implemented RBS using PIL? Anyone looked at doing it and
backed away?
...

**Rotate Matrix operator? #2**Dear all
has anybody handle such a strange transfer of matrix? like
1 2 3 operator?? 1 0 0
4 5 0 -------------> 4 2 0
6 0 0 6 5 3
it seems like to nip the first row vector as the diagonal
terms of new matrix, the second row also clockwise rotates
45 degree, and so on.. the rest triangle upper part are
taken to be zero. Maybe it is stupid, but if you know how to
make it or it does exist a command in Matlab, please let me
know.Thank you very much.
...

**Problem with shift operation #2**I hav the follwoing simple code which does left shifting operation.
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
entity counter is
port (
q: inout STD_LOGIC_VECTOR (3 downto 0);
clock: in STD_LOGIC;
reset: in STD_LOGIC;
en: in STD_LOGIC
);
end counter;
architecture counter of counter is
signal count:std_logic_vector(3 downto 0):="0000";
begin
process(clock,reset)
begin
if reset='0' then
count<="0000";
...

**How to do the shift bit operation in Array**type B_Matrix is array (0 to 3) of std_logic_vector(15 downto 0);
signal MatrixB : B_Matrix :=(others =>(others=>'0'));
For example MatrixB has some values {"1000001010101010",
"1000001010111010",..........}
Now I want to get the first bit of MatrixB(2) to give variable ad like
that: ad := MatrixB(2, 15); It doesn't work. Sounds like I use the
wrong grammar. Does anybody know how to do that.
One more thing, Can I do the operation like :
d2Rkk is signed(17 downto 0):= (others=>'0');
d2Rkk (12 downto 0) :=signed(MatrixR(2, 15 downto...

**~ operator not operating as expected**I need a bool to toggle between true and false every time it is called
- easy I thought
bool flag = false // ie 0
....
cout << (int)flag << "\n";
flag = ~flag;.
....
what I
0
1
1
1
1
OK I can implement the functionality with a couple of if's but I
thought the above was more elegant and am mystified as to why it
fails,
Can anyone enlighten me ?
Dave
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
jk@pusspaws.net wrote:
> I need a bool to toggle between true and false...

**overloaded * operator and *= operator**Can anyone help me complete this program? It is almost finished
except for the multiplication of Polynomials algorithms. I can't seem
to correctly implement the process. Thanks.
#include < iostream.h >
#include < iomanip.h >
class Polynomial {
friend istream &operator>>( istream &, Polynomial & );
friend ostream &operator<<( istream &, Polynomial & );
public:
Polynomial::Polynomial();
Polynomial operator+(Polynomial &);
Polynomial operator-( Polynomial &);
Polynomial operator+=(Po...

**Bit wise shift operators**Can anyone throw light on >>, >>> operators in java language?
I am new to Java.
mrinalroy wrote:
> Can anyone throw light on >>, >>> operators in java language?
What does your Java textbook say? What did Google come up with? What
does Sun write in their introduction tutorial?
> I am new to Java.
Which is not an excuse to do your own search first.
/Thomas
--
The comp.lang.java.gui FAQ:
http://gd.tuwien.ac.at/faqs/faqs-hierarchy/comp/comp.lang.java.gui/
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
mrinalroy wrote
> Can anyone th...

**Regarding left shift operator**Respected Experts,
Iam RaviKumar.N, I have a query regarding left shift operator.
Consider the following variables:
1) unsigned char a = 2;
2) unsigned char b = 3;
3) unsigned short c;
Consider the following expression:
c = (unsigned short)(( a << 8) | b);
My query is:
"Is it valid to shift a byte value by an 8-bit".
I got this expression compiled,but Iam not sure about the results I got.
Please let me know about this.
With Regards
Ravi Kumar.N
> Respecte...