PDA

View Full Version : Tiểu tử hỏi về toán tử <<=


gianghotieutu
14-07-2006, 09:13 PM
Cho em hỏi về toán tử <<= em không hiểu nó làm gì .
bác nào cho em ví dụ về nó với

namqn
14-07-2006, 09:29 PM
Toán tử này nằm ở đâu (trong ngôn ngữ, tài liệu nào) mới được?

Thân,

falleaf
14-07-2006, 09:46 PM
Toán tử << là toán tử dịch trái, còn toán tử <<= thì có thể như một phép gán sau khi dịch

Nghĩa là x << y có nghĩa là dịch trái y bit thanh ghi x. Còn khi viết

x<<=y thì có nghĩa là gán x=x<<y, có nghĩa là sau khi dịch xong, thì gán lại vào x.

Đây là chuẩn viết C, trong CCS C hoặc HT PICC đều như nhau. Trong tất cả các chương trình dịch, compiler khác cũng như vậy (các trình dịch gốc C).

Chúc vui

falleaf
14-07-2006, 10:04 PM
Đây là bảng các toán tử

\begin{tabular}{|c|l|} \hline + & Addition\ Operator\\ += & Addition\ assignment\ operator,\ x+=y,\ is\ the\ same\ as\ x=x+y\\ \&= & Bitwise\ and\ assignment\ operator,\ x\&=y,\ is\ the\ same\ as\ x=x\&y\\ \& & Address\ operator\\ \& & Bitwise\ and\ operator\\ \^= & Bitwise\ exclusive\ or\ assignment\ operator,\ x\^=y,\ is\ the\ same\ as\ x=x\^y\\ \^ & Bitwise\ exclusive\ or\ operator\\ l= & Bitwise\ inclusive\ or\ assignment\ operator,\ xl=y,\ is\ the\ same\ as\ x=xly\\ l & Bitwise\ inclusive\ or\ operator\\ ?: & Conditional\ Expression\ operator\\ - - & Decrement\\ /= & Division\ assignment\ operator,\ x\=y,\ is\ the\ same\ as\ x=x/y\\ / & Division\ operator\\ == & Equality\\ > & Greater\ than\ operator\\ >= & Greater\ than\ or\ equal\ to\ operator\\ ++ & Increment\\ * & Indirection\ operator\\ != & Inequality\\ <<= & Left\ shift\ assignment\ operator,\ x<<=y,\ is\ the\ same\ as\ x=x<<y\\ < & Less\ than\ operator\\ << & Left\ Shift\ operator\\ <= & Less\ than\ or\ equal\ to\ operator\\ \&\& & Logical\ AND\ operator\\ ! & Logical\ negation\ operator\\ ll & Logical\ OR\ operator\\ \%= & Modules\ assignment\ operator\ x\%=y,\ is\ the\ same\ as\ x=x%y\\ % & Modules\ operator\\ *= & Multiplication\ assignment\ operator,\ x*=y,\ is\ the\ same\ as\ x=x*y\\ * & Multiplication\ operator\\ \~ & One's\ complement\ operator\\ >>= & Right\ shift\ assignment,\ x>>=y,\ is\ the\ same\ as\ x=x>>y\\ >> & Right\ shift\ operator\\ -> & Structure\ Pointer\ operation\\ -= & Subtraction\ assignment\ operator\\ - & Subtraction\ operator\\ sizeof & Determines\ size\ in\ bytes\ of\ operand\\ \hline \end{tabular}

Đây là bảng toán tử tham khảo của CCS C, gần như hoàn toàn trùng với cách sử dụng toán tử của các ngôn ngữ nguồn gốc C khác. Đa số các ngôn ngữ lập trình cho vi điều khiển, vi xử lý, chỉ khác nhau về các hàm, lệnh mà thôi.

Lưu ý, các dấu ~ và dấu ^ hơi nhỏ, các bạn xem thêm trong phần Help, nhưng F viết luôn ra đây chỉ nhằm mục đích cho các bạn tiện theo dõi.

Chúc vui