summaryrefslogtreecommitdiffstats
path: root/recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl')
-rwxr-xr-xrecipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl6
1 files changed, 5 insertions, 1 deletions
diff --git a/recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl b/recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl
index a4e8008f..c6222022 100755
--- a/recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl
+++ b/recipes-bsp/change-file-endianess/change-file-endianess/byte_swap.tcl
@@ -18,12 +18,16 @@ if {$old_rem != 0} {
18 append old_bin y 18 append old_bin y
19 } 19 }
20} 20}
21for {set i 0} {$i<[string length $old_bin]} {incr i $num_b} { 21for {set i 0} {$i<[expr $old_length-8]} {incr i $num_b} {
22 for {set j $num_b} {$j>0} {incr j -1} { 22 for {set j $num_b} {$j>0} {incr j -1} {
23 append new_bin [string index $old_bin [expr $i+($j-1)]] 23 append new_bin [string index $old_bin [expr $i+($j-1)]]
24 } 24 }
25} 25}
26 26
27for {set j 0} {$j<8} {incr j 1} {
28 append new_bin [string index $old_bin [expr $i+$j]]
29}
30
27for {set i 0} {$i<[string length $old_bin]} {incr i $num_b} { 31for {set i 0} {$i<[string length $old_bin]} {incr i $num_b} {
28 set binValue [string range $old_bin [expr $i+0] [expr $i+($num_b-1)]] 32 set binValue [string range $old_bin [expr $i+0] [expr $i+($num_b-1)]]
29 binary scan $binValue H[expr $num_b*2] hexValue 33 binary scan $binValue H[expr $num_b*2] hexValue