Results 1 to 6 of 6

Thread: Bitwise Concatenation In Int

  1. #1
    Join Date
    Jan 2009
    Posts
    61

    Bitwise Concatenation In Int

    Hello, I am searching for the scrip which can provide me the bitwise concatenation of the two integer numbers. If anyone is having solution for it, then please solve my problem by replying me some solution.

  2. #2
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Bitwise Concatenation In Int

    I have tried for the same but not able to get the solution for it. I have done following:
    Code:
    short num;
    int num2;
    
    in hex (num2>> 8) -> 3
    num.byteValue () -> 7b
    
    //I want to num2 = 37b
    
    x = (num2>> 8) | (num.byteValue ());

  3. #3
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Bitwise Concatenation In Int

    Hello, I think you need to make use of the code below which can provide you the concatenation in Integer. So, just make use of it and solve your problem.

    Code:
    x = (x & 0xFF00) | (w1 & 0x00FF);

  4. #4
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Bitwise Concatenation In Int

    For the solution on this problem of your, you must make use of the code below. But it is designed in the C#.
    Code:
    #include "Port.h"
    #include "BinaryConversion.h"
    # include "iostream.h"
    Port prt;
    long binary(long);
    void BinaryConversion::test()
    {
    long num,r;
    num=prt.GetToken_DecimalNo();
    printf("Inside user code %d",num);
    r=binary(num);
    prt.Send(r);
    }
    long binary(long num)
    {
    long rndr;
    long re;
    while(num >1)
    {
    rndr = num%2;
    num = num / 2;
    re = re & rndr;
    }
    
    return(re);
    
    }

  5. #5
    Join Date
    May 2008
    Posts
    2,012

    Re: Bitwise Concatenation In Int

    I am not having knowledge about the javascript. But, I know the c language. If you want to concetenation of integers in c then you make use of the code below:
    Code:
    #include <stdio.h>
    int main()
    {
      int num = 45, num1=5, num2= 8;
      char chr[20];
      sprintf(chr, "%d%d%d", num, num1, num2);
      puts(chr);
      return 0;
    }

  6. #6
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Bitwise Concatenation In Int

    You can make use of the code below :
    Code:
    x = (x & 0xFFFFFF00) | (w1 & 0x00FF);
    OR you can also make use of the code as below:
    Code:
    x = (x & (-1 << 8)) | (w1 & 0xFF);

Similar Threads

  1. Concatenation of several large files
    By Gafur in forum Software Development
    Replies: 4
    Last Post: 12-02-2010, 10:58 AM
  2. Use of Bitwise Logical Operators : C
    By Gavyn in forum Software Development
    Replies: 4
    Last Post: 06-02-2010, 04:25 PM
  3. String Concatenation in mySQL
    By JPGargoyle in forum Software Development
    Replies: 2
    Last Post: 18-05-2009, 10:38 AM
  4. Memory allocation optimized bitwise
    By Ricky58 in forum Software Development
    Replies: 3
    Last Post: 07-05-2009, 10:53 AM
  5. String concatenation in VB6
    By Harshini in forum Software Development
    Replies: 2
    Last Post: 21-03-2009, 09:25 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,065,173.45344 seconds with 17 queries