X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=tcl%2Fbitsbytes.tcl;h=2c4fd2907074f0008d2a585d320cffc7bfb61bf8;hb=HEAD;hp=5f9cae114745bf2d89f003160680f9edcebb95d5;hpb=f5657aa76e795e4ed5b13a9f5df943181a123e49;p=fw%2Fopenocd diff --git a/tcl/bitsbytes.tcl b/tcl/bitsbytes.tcl index 5f9cae114..03d758e7c 100644 --- a/tcl/bitsbytes.tcl +++ b/tcl/bitsbytes.tcl @@ -1,8 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + #---------------------------------------- # Purpose - Create some $BIT variables # Create $K and $M variables # and some bit field extraction variables. -# Creat helper variables ... +# Create helper variables ... # BIT0.. BIT31 for { set x 0 } { $x < 32 } { set x [expr {$x + 1}]} { @@ -36,7 +38,7 @@ proc create_mask { MSB LSB } { # Result: 0x02340000 proc extract_bitfield { VALUE MSB LSB } { - return [expr [create_mask $MSB $LSB] & $VALUE] + return [expr {[create_mask $MSB $LSB] & $VALUE}] } @@ -47,7 +49,7 @@ proc extract_bitfield { VALUE MSB LSB } { # Result: 0x00000234 # proc normalize_bitfield { VALUE MSB LSB } { - return [expr [extract_bitfield $VALUE $MSB $LSB ] >> $LSB] + return [expr {[extract_bitfield $VALUE $MSB $LSB ] >> $LSB}] } proc show_normalize_bitfield { VALUE MSB LSB } {