tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] [PATCH 3/4] x86_64: multibyte code emit


From: Dmitry Selyutin
Subject: [Tinycc-devel] [PATCH 3/4] x86_64: multibyte code emit
Date: Sun, 14 Feb 2021 22:52:21 +0300

---
 x86_64-gen.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/x86_64-gen.c b/x86_64-gen.c
index 0ff2041..15d6b53 100644
--- a/x86_64-gen.c
+++ b/x86_64-gen.c
@@ -174,6 +174,22 @@ ST_FUNC void g(int c)
     ind = ind1;
 }

+ST_FUNC void gbc(const void *data, size_t size)
+{
+    size_t byte;
+    size_t new_ind;
+    const unsigned char *bytes = data;
+
+    new_ind = (ind + size);
+    if (new_ind > cur_text_section->data_allocated)
+        section_realloc(cur_text_section, new_ind);
+
+    for (byte = 0; byte != size; ++byte)
+        cur_text_section->data[ind++] = bytes[byte];
+
+    ind = new_ind;
+}
+
 ST_FUNC void o(unsigned int c)
 {
     while (c) {
--
2.30.0



reply via email to

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