poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] doc: fix variable's type in code snippet in manual


From: Guillermo E. Martinez
Subject: [PATCH] doc: fix variable's type in code snippet in manual
Date: Sun, 4 Jul 2021 21:01:46 -0500

  declaring int b[4] and using read (fd, &b[i], 1),
  just read the first 8-bits for an integer variable
  (32-bits wide). So doing the OR and bit shift operations
  doesn't warranty that most significat bits are zeros,
  and the computed number value is not right.
---
 doc/poke.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/poke.texi b/doc/poke.texi
index 975c39b0..a712fb8c 100644
--- a/doc/poke.texi
+++ b/doc/poke.texi
@@ -309,7 +309,7 @@ multiply it by two, and store the result at the same offset.
 void double_number (int fd, off_t offset, int endian)
 @{
    int number, i;
-   int b[4];
+   char b[4];
 
    /* Decode.  */
    lseek (fd, offset, SEEK_SET);
-- 
2.30.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]