Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
15c44903fThis file is pinned to the selected release. Download the original to open it in your design tool.
#!/bin/bash
bit_msk() {
local a=$1; local b=${2:-$1}; local val=0
for i in `seq $a $b`; do
val=$(( val | ( 1 << i) ))
done
echo $val
}
bit_map() {
local v=$1; local a=$2; local b=$3; local n=$4
local msk=`bit_msk $a $b`
local val=$(( (v & ~msk) | ((n << a) & msk) ))
echo $val
}