[gnome-remote-desktop] utils: Add helper to calculate aligned sizes



commit c4b2217c7e19fe5da4ea62a2c9247360f2f93aa5
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Fri Mar 4 10:42:58 2022 +0100

    utils: Add helper to calculate aligned sizes

 src/grd-utils.h | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/grd-utils.h b/src/grd-utils.h
index 7ef4e10f..f627660a 100644
--- a/src/grd-utils.h
+++ b/src/grd-utils.h
@@ -21,6 +21,7 @@
 #define GRD_UTILS_H
 
 #include <gio/gio.h>
+#include <stdint.h>
 
 typedef struct _GrdSyncPoint
 {
@@ -31,6 +32,13 @@ typedef struct _GrdSyncPoint
   gboolean success;
 } GrdSyncPoint;
 
+static inline uint32_t
+grd_get_aligned_size (uint32_t size,
+                      uint32_t alignment)
+{
+  return size + (size % alignment ? alignment - size % alignment : 0);
+}
+
 void grd_sync_point_init (GrdSyncPoint *sync_point);
 
 void grd_sync_point_clear (GrdSyncPoint *sync_point);


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