OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

virtio-dev message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [PATCH] introduction: add note on bitfield portability


Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 introduction.tex | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/introduction.tex b/introduction.tex
index d0b770e..18ad76e 100644
--- a/introduction.tex
+++ b/introduction.tex
@@ -175,5 +175,12 @@ packed by C compilers on little-endian architectures but not the
 way bitfields are packed by C compilers on big-endian
 architectures.
 
+Assuming that CPU_TO_BE16 converts a 16-bit integer from a native
+CPU to the big-endian byte order, the following is the equivalent
+portable C code to generate a value in this format:
+\begin{lstlisting}
+CPU_TO_BE16(B << 15 | A)
+\end{lstlisting}
+
 \newpage
 
-- 
MST


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]