diff mbox

[1/3] fbuffer: simplify address computations in fb8-toggle-cursor

Message ID 20150528131314.5240.44784.stgit@bahia.lab.toulouse-stg.fr.ibm.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Greg Kurz May 28, 2015, 1:13 p.m. UTC
The inner loop deals with a contiguous region. It could easily be replaced
by faster board specific functions like hv-logical-memop in board-qemu.
Since hv-logical-memop does not return an address, let's have the enclosing
loop compute the next line address by itself and drop the confusing
"char-width screen-depth * -" address adjustment.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
---
 slof/fs/fbuffer.fs |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Thomas Huth May 28, 2015, 1:30 p.m. UTC | #1
On Thu, 28 May 2015 15:13:14 +0200
Greg Kurz <gkurz@linux.vnet.ibm.com> wrote:

> The inner loop deals with a contiguous region. It could easily be replaced
> by faster board specific functions like hv-logical-memop in board-qemu.
> Since hv-logical-memop does not return an address, let's have the enclosing
> loop compute the next line address by itself and drop the confusing
> "char-width screen-depth * -" address adjustment.
> 
> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> ---
>  slof/fs/fbuffer.fs |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/slof/fs/fbuffer.fs b/slof/fs/fbuffer.fs
> index 756f05a..faae6a9 100644
> --- a/slof/fs/fbuffer.fs
> +++ b/slof/fs/fbuffer.fs
> @@ -99,8 +99,8 @@ CREATE bitmap-buffer 400 4 * allot
>  : fb8-toggle-cursor ( -- )
>  	line# fb8-line2addr column# fb8-columns2bytes +
>  	char-height 0 ?DO
> -		char-width screen-depth * 0 ?DO dup dup rb@ -1 xor swap rb! 1+ LOOP
> -		screen-width screen-depth * + char-width screen-depth * -
> +		dup char-width screen-depth * 0 ?DO dup dup rb@ -1 xor swap rb! 1+ LOOP drop
> +		screen-width screen-depth * +
>  	LOOP drop
>  ;

Reviewed-by: Thomas Huth <thuth@redhat.com>
Nikunj A Dadhania May 29, 2015, 4:17 a.m. UTC | #2
Greg Kurz <gkurz@linux.vnet.ibm.com> writes:

> The inner loop deals with a contiguous region. It could easily be replaced
> by faster board specific functions like hv-logical-memop in board-qemu.
> Since hv-logical-memop does not return an address, let's have the enclosing
> loop compute the next line address by itself and drop the confusing
> "char-width screen-depth * -" address adjustment.

Much better :-)

Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>

>
> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> ---
>  slof/fs/fbuffer.fs |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/slof/fs/fbuffer.fs b/slof/fs/fbuffer.fs
> index 756f05a..faae6a9 100644
> --- a/slof/fs/fbuffer.fs
> +++ b/slof/fs/fbuffer.fs
> @@ -99,8 +99,8 @@ CREATE bitmap-buffer 400 4 * allot
>  : fb8-toggle-cursor ( -- )
>  	line# fb8-line2addr column# fb8-columns2bytes +
>  	char-height 0 ?DO
> -		char-width screen-depth * 0 ?DO dup dup rb@ -1 xor swap rb! 1+ LOOP
> -		screen-width screen-depth * + char-width screen-depth * -
> +		dup char-width screen-depth * 0 ?DO dup dup rb@ -1 xor swap rb! 1+ LOOP drop
> +		screen-width screen-depth * +
>  	LOOP drop
>  ;
diff mbox

Patch

diff --git a/slof/fs/fbuffer.fs b/slof/fs/fbuffer.fs
index 756f05a..faae6a9 100644
--- a/slof/fs/fbuffer.fs
+++ b/slof/fs/fbuffer.fs
@@ -99,8 +99,8 @@  CREATE bitmap-buffer 400 4 * allot
 : fb8-toggle-cursor ( -- )
 	line# fb8-line2addr column# fb8-columns2bytes +
 	char-height 0 ?DO
-		char-width screen-depth * 0 ?DO dup dup rb@ -1 xor swap rb! 1+ LOOP
-		screen-width screen-depth * + char-width screen-depth * -
+		dup char-width screen-depth * 0 ?DO dup dup rb@ -1 xor swap rb! 1+ LOOP drop
+		screen-width screen-depth * +
 	LOOP drop
 ;