[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] ios,pkl: get rid of `peeks'/`pokes' instructions
From: |
Jose E. Marchesi |
Subject: |
Re: [PATCH] ios,pkl: get rid of `peeks'/`pokes' instructions |
Date: |
Mon, 08 Apr 2024 09:09:09 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hi Mohammad.
Thanks for the patch.
I would call the functions before _pkl_peek_string and _pkl_poke_string.
There is no need to establish they are some sort of "instructions" IMO.
Other than that, OK for master.
Thanks!
> +/* Implementation of pokes and peeks "instructions". */
> +
> +immutable fun _pkl_insn_peeks = (int<32> ios, uint<64> boffset) string:
> +{
> + var s = "",
> + off = boffset#1;
> +
> + while (1)
> + {
> + var byte = uint<8> @ ios : off;
> +
> + if (!byte)
> + break;
> + s += byte as string;
> + off += 8#1;
> + }
> + return s;
> +}
> +
> +immutable fun _pkl_insn_pokes = (int<32> ios, uint<64> boffset, string s)
> void:
> +{
> + var off = boffset#1;
> +
> + for (c in s)
> + {
> + uint<8> @ ios : off = c;
> + off += 8#1;
> + }
> + uint<8> @ ios : off = 0; /* Final '\0' byte. */
> +}
> +
> /* Return whether the given value is integral, i.e. if it is
> either a PVM int, uint, long or ulong. */