File tree Expand file tree Collapse file tree 2 files changed +22
-16
lines changed
Expand file tree Collapse file tree 2 files changed +22
-16
lines changed Original file line number Diff line number Diff line change @@ -31,16 +31,19 @@ void kontrolbit(int *kod, int lengh)
3131
3232void invert (int * byte )
3333{
34- int tmp [8 ], g = 0 ;
35- for (int i = 7 ; i > -1 ; i -- )
36- tmp [g ++ ] = byte [i ];
37- for (int i = 0 ; i < 8 ; i ++ )
38- byte [i ] = tmp [i ];
34+ int i , t ;
35+ for (i = 0 ; i < 4 ; i ++ )
36+ {
37+ t = byte [i ];
38+ byte [i ] = byte [7 - i ];
39+ byte [7 - i ] = t ;
40+ }
3941}
4042
4143void tobit (int x , int * byte )
4244{
43- for (int i = 0 ; i < 8 ; i ++ )
45+ int i ;
46+ for (i = 0 ; i < 8 ; i ++ )
4447 {
4548 byte [i ] = x %2 ;
4649 x >>= 1 ;
@@ -50,8 +53,8 @@ void tobit(int x, int *byte)
5053
5154int todec (int * byte )
5255{
53- int x = 0 , st = 7 ;
54- for (int i = 0 ; i < 8 ; i ++ )
56+ int i , x = 0 , st = 7 ;
57+ for (i = 0 ; i < 8 ; i ++ )
5558 {
5659 x += (byte [i ]<<st );
5760 st -- ;
Original file line number Diff line number Diff line change @@ -27,16 +27,19 @@ void kontrolbit(int *kod, int lengh)
2727
2828void invert (int * byte )
2929{
30- int tmp [8 ], g = 0 ;
31- for (int i = 7 ; i > -1 ; i -- )
32- tmp [g ++ ] = byte [i ];
33- for (int i = 0 ; i < 8 ; i ++ )
34- byte [i ] = tmp [i ];
30+ int i , t ;
31+ for (i = 0 ; i < 4 ; i ++ )
32+ {
33+ t = byte [i ];
34+ byte [i ] = byte [7 - i ];
35+ byte [7 - i ] = t ;
36+ }
3537}
3638
3739void tobit (int x , int * byte )
3840{
39- for (int i = 0 ; i < 8 ; i ++ )
41+ int i ;
42+ for (i = 0 ; i < 8 ; i ++ )
4043 {
4144 byte [i ] = x %2 ;
4245 x >>= 1 ;
@@ -46,8 +49,8 @@ void tobit(int x, int *byte)
4649
4750int todec (int * byte )
4851{
49- int x = 0 , st = 7 ;
50- for (int i = 0 ; i < 8 ; i ++ )
52+ int i , x = 0 , st = 7 ;
53+ for (i = 0 ; i < 8 ; i ++ )
5154 {
5255 x += (byte [i ]<<st );
5356 st -- ;
You can’t perform that action at this time.
0 commit comments