From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatolij Gustschin Date: Fri, 22 May 2020 16:02:33 +0200 Subject: [PATCH 05/26] video: Split out expression parts into variables In-Reply-To: <20200519231058.19945-6-sjg@chromium.org> References: <20200519231058.19945-1-sjg@chromium.org> <20200519231058.19945-6-sjg@chromium.org> Message-ID: <20200522160233.5dbd4000@crub> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, 19 May 2020 17:10:37 -0600 Simon Glass sjg at chromium.org wrote: > The functions in this file do similar things but not always in the same > way. To make the code easier to read and compare, use a separate 'linenum' > variable in every function. This is then multiplied by the line length to > get the offset within the frame buffer to modify. Also use an 'x' variable > to hold the pixel position within that line. This is multipled by the > pixel size and added to the offset. > > Also move the pbytes declaration up a little with the other long lines. > > A side effect of splitting out these variables is that they are promoted > to int, i.e. a signed type, from the unsigned short used in the > vidconsole_priv struct. This would be necessary should any of the > variables go negative. At present this can actually happen in > console_putc_xy_2(), if the display width is not a multiple of the > character size (see next patch). > > Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin