linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mehran Rezaei <mehran@cs.unt.edu>
To: Codex <codex@telkom.net>
Cc: Linux-C-Programming <linux-c-programming@vger.kernel.org>
Subject: Re: value assignment
Date: Tue, 10 Sep 2002 08:29:19 +0000	[thread overview]
Message-ID: <3D7DAD5F.1E822F2C@cs.unt.edu> (raw)
In-Reply-To: 20020910235856.25bd3fd3.codex@telkom.net

Codex wrote:

> pterm.iflag &= ~(IGNBRK | INLCR)
>
> what the hell is '&=' and '~(...)', what does '(...)' does anyway..?,
> wasn't '|' means OR..?

>

Good morning,

So, they are all bitwise operations. & is bitwise AND, | is OR, ~ one's complement.
Do you know what happens when you say i*=5 (i=i*5), the same thing when you say i&=5
(i=i&5).
Say i is 15 then i&=5  is 001111 & 000101 = 000101. ~ is a little bit more
complecated, that is when the size of your variable is important. If i is an integer
(of course the size of i depends on your system, but generally say 32 bits) then ~i
(when i is 15) will be
~0000000000001111=1111111111110000=fff0 Hex.
So long,

Mehran


  reply	other threads:[~2002-09-10  8:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-10 16:58 value assignment Codex
2002-09-10  8:29 ` Mehran Rezaei [this message]
2002-09-10 15:39 ` Stephen Satchell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D7DAD5F.1E822F2C@cs.unt.edu \
    --to=mehran@cs.unt.edu \
    --cc=codex@telkom.net \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).