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

  • SEARCH
  • Home
  • 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 981767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:35:41+00:00 2026-05-16T04:35:41+00:00

c++: static void doIp(byte data[]) { unsigned char j, k; byte val; byte buf[8];

  • 0

c++:

static void doIp(byte data[])
{
  unsigned char j, k;
  byte val;
  byte buf[8];
  byte *p;
  byte i = 8;

  for(i=0; i<8; i++)
  {
    val = data[i];
    p = &buf[3];
    j = 4;

    do
    {
      for(k=0; k<=4; k+=4)
      {
        p[k] >>= 1;
        if(val & 1) p[k] |= 0x80;
        val >>= 1;
      }
      p--;
    } while(--j);
  }

  memcpy(data, buf, 8);
}

c#:
?

  • 1 1 Answer
  • 1 View
  • 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-16T04:35:42+00:00Added an answer on May 16, 2026 at 4:35 am
    class someclass {
        public static void doIp(byte[] data)
        {
            uint j, k; // these are just counters, so uint is fine
            byte val;
            byte[] buf = new byte[8];  // syntax changed here
            byte p;                    // you end up using p simply as an offset from buf
            byte i = 8;
    
            for(i=0; i<8; i++)
            {
                val = data[i];
                p = 3;
                j = 4;
    
                do
                {
                    for(k=0; k<=4; k+=4)
                    {
                        buf[p+k] >>= 1;
                        if((val & 1) != 0) buf[p+k] |= 0x80; // must test against 0 explicitly in C#
                        val >>= 1;
                    }
                    p--;
                } while(--j != 0); // must test against 0 explicitly in C#
            }
    
            Array.Copy(buf, data, 8);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

static void Main() { string str; str = Console.ReadLine(); while (str != null)//HERE! {
public static void main(String[] args) { int i = 0; while(i==0){ System.out.println(Possibilities: R, T,
public static void main(String Data[]) { ConnectionPoolDataSource dps; try { cnt=new InitialContext(); cnt.rebind(java:comp/env/jdbc/pool/dragon, dps);
public static void ejemplosString(String palabra){ char[] letras = palabra.toCharArray(); int contadorVocales = 0; for
static void HandlePackets(void* pParams) { int iResult = 0; char recvbuf[MAX_PACKET_LENGTH]; printf(Packet handling started\n);
public static void displayInfo(KeyEvent e){ int id = e.getID(); String keyString; char c =
public static void main(String args[]) { Random r = new Random(); BufferedImage buf =
static void testlock() { for(int i=0;i<10000000;i++) { float f=2.0/i; } } static void TEST()
static void Main(string[] args) { //read in the file StreamReader convert = new StreamReader(../../convert.txt);
static void main(args){ System.in.withReader { def input = it.readLine() for(def i = 0; i

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.