Translation C++ -> VB

This code change the format of the data, so i can use it on x86. Can someone translate this to VB. I have VS6. I tried, but it dont works correct.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
int Convert::Float_Basic_to_C(float *src4, float *dest4)
{
     unsigned char *msbin = (unsigned char *)src4;
     unsigned char *ieee = (unsigned char *)dest4;
     unsigned char sign = 0x00;
     unsigned char ieee_exp = 0x00;
     int i;

     sign = msbin[2] & 0x80;

     for(i=0; i<4; i++)
       ieee[i] = 0;

     if(msbin[3] == 0)
       return 0;

     ieee[3] |= sign;

     ieee_exp = msbin[3] - 2;

     ieee[3] |= ieee_exp >> 1;
     ieee[2] |= ieee_exp << 7;
     ieee[2] |= msbin[2] & 0x7f;

     ieee[1] = msbin[1];
     ieee[0] = msbin[0];

     return 0;
}


Actually, I`m trying to put it in excel workbook.
Last edited on
Topic archived. No new replies allowed.