Instead of reimplementing it several times use parse-nhex to decode two hex numbers,
Signed-off-by: BALATON Zoltan balaton@eik.bme.hu --- arch/sparc64/tree.fs | 6 +----- drivers/esp.fs | 6 +----- drivers/sbus.fs | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/arch/sparc64/tree.fs b/arch/sparc64/tree.fs index af8948d..f390f6c 100644 --- a/arch/sparc64/tree.fs +++ b/arch/sparc64/tree.fs @@ -5,11 +5,7 @@ include config.fs \ -------------------------------------------------------------------------
: decode-unit-upa ( str len -- id lun ) - ascii , left-split - ( addr-R len-R addr-L len-L ) - parse-hex - -rot parse-hex - swap + 2 parse-nhex ;
: encode-unit-upa ( id lun -- str len) diff --git a/drivers/esp.fs b/drivers/esp.fs index 9e37c0a..ebf0769 100644 --- a/drivers/esp.fs +++ b/drivers/esp.fs @@ -3,11 +3,7 @@ \ -------------------------------------------------------------------------
: decode-unit-scsi ( str len -- id lun ) - ascii , left-split - ( addr-R len-R addr-L len-L ) - parse-hex - -rot parse-hex - swap + 2 parse-nhex ;
: encode-unit-scsi ( id lun -- str len) diff --git a/drivers/sbus.fs b/drivers/sbus.fs index b84a3ac..9aa51e2 100644 --- a/drivers/sbus.fs +++ b/drivers/sbus.fs @@ -3,11 +3,7 @@ \ -------------------------------------------------------------------------
: decode-unit-sbus ( str len -- id lun ) - ascii , left-split - ( addr-R len-R addr-L len-L ) - parse-hex - -rot parse-hex - swap + 2 parse-nhex ;
: encode-unit-sbus ( id lun -- str len)