Messages in this thread | | | Date | Wed, 8 Jun 2022 08:59:23 +0200 | Subject | Re: [PATCH 10/36] tty/vt: consolemap: introduce UNI_*() macros | From | Jiri Slaby <> |
| |
On 07. 06. 22, 15:47, Ilpo Järvinen wrote: > On Tue, 7 Jun 2022, Jiri Slaby wrote: > >> The code currently does shift, OR, and AND logic directly in the code. >> It is not much obvious what happens there. Therefore define four macros >> for that purpose and use them in the code. We use GENMASK() so that it >> is clear which bits serve what purpose: >> - UNI_GLYPH: bits 0.. 5 >> - UNI_ROW: bits 6..10 >> - UNI_DIR: bits 11..31 >> >> Signed-off-by: Jiri Slaby <jslaby@suse.cz> >> --- >> drivers/tty/vt/consolemap.c | 21 +++++++++++++-------- >> 1 file changed, 13 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c >> index 016c1a0b4290..e5fd225e87bd 100644 >> --- a/drivers/tty/vt/consolemap.c >> +++ b/drivers/tty/vt/consolemap.c >> @@ -190,6 +190,11 @@ static int inv_translate[MAX_NR_CONSOLES]; >> #define UNI_DIR_ROWS 32U >> #define UNI_ROW_GLYPHS 64U >> >> +#define UNI_DIR(uni) ( (uni) >> 11) >> +#define UNI_ROW(uni) (((uni) & GENMASK(10, 6)) >> 6) > > This is opencoding what FIELD_GET() does. Maybe just define these as > masks and use FIELD_GET in the code below.
Ah, great -- I was thinking there should be something for that purpose already, but didn't find this. But let's define these UNI_* macros using appropriate FIELD_GET(). (And not using FIELD_GET() in the code.)
>> +#define UNI_GLYPH(uni) ( (uni) & GENMASK( 5, 0)) thanks, -- js suse labs
| |