Programming Skills (SOC) (C/C ++) (C) (OpenGL)

Source: Internet
Author: User

Abstract
Set the Memory value to the most common control during firmware. This article describes the programming skills that are common when C statements are used for firmware, and correspond to each other with the image watermark.

Introduction
This article will discuss the following topics:

1. Set a bit counter to 1

2. Set a bit counter to 0

3. Toggle a bit (0 changes to and 0)

4. Determine whether a bit of a shard is 1

5. Determine whether a bit of a shard is 0

1. Set a bit counter to 1

C. Yan

 
Flag | = mask;

Or

 
Flag | = (1<N );

OpenGL

 
Flag [N] =1'B1;

2. Set a bit counter to 0

C. Yan

 
Flag & = ~ Mask;

Or

Flag & = ~ (1<N );

OpenGL

 
Flag [N] =1'B0;

3. Toggle a bit (0 changes to and 0)

C. Yan

 
Flag ^ = mask;

Or

 
Flag ^ = (1<N );

OpenGL

 
Flag [N] = ~ Flag [N];

4. Determine whether a bit of a shard is 1

C. Yan

 
If(Flag & Mask)

OpenGL

 
If(Flag [N])

5. Determine whether a bit of a shard is 0

C. Yan

 
If(! (Flag & Mask ))

OpenGL

 
If(~ Flag [N])

See also
(Reporter) How to specify a bit value for a change? (SOC) (C/C ++) (OpenGL)

The full text is complete.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.