Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6912577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:06:35+00:00 2026-05-27T09:06:35+00:00

If I perform a Bitwise AND between a 8 bit integer ( int8_t )

  • 0

If I perform a Bitwise AND between a 8 bit integer (int8_t) and 32 bit integer (int) will the result be a 8 bit integer or a 32 bit integer?

I am using GNU/Linux and GCC compiler

To put the question slightly differently, before performing the bitwise AND, are the first 24 bits of the 32 bit integer discarded, or is the 8 bit integer first typecast to a 32 bit integer ?

EDIT: In this little code

#include <iostream>
#include <stdint.h>
int main()
{
  int    i=34;
  int8_t j=2;

  std::cout<<sizeof((i&j))<<std::endl;//Bitwise and between a 32 bit integer and 8 bit integer
  return 0;
}

I get the output as 4. I would assume that means that the result is a 32 bit integer then. But I don’t know if the result depends on the machine, compiler or OS.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:06:36+00:00Added an answer on May 27, 2026 at 9:06 am

    For the & operator (and most other operators), any operands smaller than int will be promoted to int before the operation is evaluated.

    From the C99 standard (6.5.10 – describing the bitwise AND operator):

    The usual arithmetic conversions are performed on the operands.

    (6.3.1.8 – describing the usual arithmetic conversions):

    the integer promotions are performed on both operands

    (6.3.1.1 – describing the integer promotions):

    If an int can represent all values of the original type, the value is converted to an int; otherwise, it is converted to an unsigned int. These are called the integer
    promotions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to perform a bitwise left shift on a 16-bit integer (ushort /
I am new to using the PARI C library. How can I perform bitwise
I perform the iFFT on a symmetric spectrum (using Python). Why is the result
How do you perform a bitwise AND operation on two 32-bit integers in C#?
I need to perform a circular left shift of a 64-bit integer in JavaScript.
I'm trying to perform a bitwise operation on a BitArray that would result in:
I need to perform a bitwise equality between two bytes. That means that for
Challenge: Perform a bitwise XOR on two equal sized buffers. The buffers will be
I want to perform a bitwise-AND operation in VB.NET, taking a Short (16-bit) variable
I'm trying to perform a bitwise NOT in SQL Server. I'd like to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.