diff -urN gimp-2.10.38-orig/libgimpwidgets/gimpmemsizeentry.c gimp-2.10.38/libgimpwidgets/gimpmemsizeentry.c
--- gimp-2.10.38-orig/libgimpwidgets/gimpmemsizeentry.c	2024-05-03 09:33:35 +0900
+++ gimp-2.10.38/libgimpwidgets/gimpmemsizeentry.c	2024-06-23 22:27:54 +0900
@@ -68,6 +68,8 @@
 
 static guint gimp_memsize_entry_signals[LAST_SIGNAL] = { 0 };
 
+static const gint powers_of_1000[] = { 1, 1000, 1000*1000, 1000*1000*1000 };
+
 
 static void
 gimp_memsize_entry_class_init (GimpMemsizeEntryClass *klass)
@@ -99,7 +101,7 @@
   entry->value      = 0;
   entry->lower      = 0;
   entry->upper      = 0;
-  entry->shift      = 0;
+  entry->power      = 0;
   entry->adjustment = NULL;
   entry->menu       = NULL;
 }
@@ -124,7 +126,7 @@
     /* Do not allow losing accuracy if the converted/displayed value
      * stays the same.
      */
-    entry->value = size << entry->shift;
+    entry->value = size * powers_of_1000[entry->power];
 
   g_signal_emit (entry, gimp_memsize_entry_signals[VALUE_CHANGED], 0);
 }
@@ -133,9 +135,9 @@
 gimp_memsize_entry_unit_callback (GtkWidget        *widget,
                                   GimpMemsizeEntry *entry)
 {
-  guint  shift;
+  guint  power;
 
-  gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), (gint *) &shift);
+  gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), (gint *) &power);
 
 #if _MSC_VER < 1300
 #  define CAST (gint64)
@@ -143,14 +145,16 @@
 #  define CAST
 #endif
 
-  if (shift != entry->shift)
+  if (power != entry->power)
     {
-      entry->shift = shift;
+      const gint64 scale = powers_of_1000[power];
+
+      entry->power = power;
 
       gtk_adjustment_configure (entry->adjustment,
                                 gimp_memsize_entry_get_rounded_value (entry, entry->value),
-                                CAST entry->lower >> shift,
-                                CAST entry->upper >> shift,
+                                CAST entry->lower / scale,
+                                CAST entry->upper / scale,
                                 gtk_adjustment_get_step_increment (entry->adjustment),
                                 gtk_adjustment_get_page_increment (entry->adjustment),
                                 gtk_adjustment_get_page_size (entry->adjustment));
@@ -172,6 +176,7 @@
 gimp_memsize_entry_get_rounded_value (GimpMemsizeEntry *entry,
                                       guint64           value)
 {
+  const guint64 scale = powers_of_1000[entry->power];
   guint64 converted;
 
 #if _MSC_VER < 1300
@@ -180,8 +185,7 @@
 #  define CAST
 #endif
 
-  converted = (CAST value >> entry->shift) +
-              ((CAST entry->value >> (entry->shift - 1)) & 1);
+  converted = ((CAST value) + (scale / 2)) / scale;
 
 #undef CAST
 
@@ -207,7 +211,7 @@
 {
   GimpMemsizeEntry *entry;
   GtkAdjustment    *adj;
-  guint             shift;
+  guint             power;
 
 #if _MSC_VER < 1300
 #  define CAST (gint64)
@@ -219,22 +223,22 @@
 
   entry = g_object_new (GIMP_TYPE_MEMSIZE_ENTRY, NULL);
 
-  for (shift = 30; shift > 10; shift -= 10)
+  for (power = 3; power > 1; power--)
     {
-      if (value > (G_GUINT64_CONSTANT (1) << shift) &&
-          value % (G_GUINT64_CONSTANT (1) << shift) == 0)
+      if (value > powers_of_1000[power] &&
+          value % powers_of_1000[power] == 0)
         break;
     }
 
   entry->value = value;
   entry->lower = lower;
   entry->upper = upper;
-  entry->shift = shift;
+  entry->power = power;
 
   adj = (GtkAdjustment *) gtk_adjustment_new (gimp_memsize_entry_get_rounded_value (entry,
                                                                                     entry->value),
-                                              CAST (lower >> shift),
-                                              CAST (upper >> shift),
+                                              CAST (lower / powers_of_1000[power]),
+                                              CAST (upper / powers_of_1000[power]),
                                               1, 8, 0);
 
   entry->spinbutton = gimp_spin_button_new (adj, 1.0, 0);
@@ -253,12 +257,12 @@
                     G_CALLBACK (gimp_memsize_entry_adj_callback),
                     entry);
 
-  entry->menu = gimp_int_combo_box_new (_("Kibibyte"), 10,
-                                        _("Mebibyte"), 20,
-                                        _("Gibibyte"), 30,
+  entry->menu = gimp_int_combo_box_new (_("Kilobyte"), 1,
+                                        _("Megabyte"), 2,
+                                        _("Gigabyte"), 3,
                                         NULL);
 
-  gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (entry->menu), shift);
+  gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (entry->menu), power);
 
   g_signal_connect (entry->menu, "changed",
                     G_CALLBACK (gimp_memsize_entry_unit_callback),
@@ -282,20 +286,20 @@
 gimp_memsize_entry_set_value (GimpMemsizeEntry *entry,
                               guint64           value)
 {
-  guint shift;
+  guint power;
 
   g_return_if_fail (GIMP_IS_MEMSIZE_ENTRY (entry));
   g_return_if_fail (value >= entry->lower && value <= entry->upper);
 
-  for (shift = 30; shift > 10; shift -= 10)
+  for (power = 3; power > 1; power--)
     {
-      if (value > (G_GUINT64_CONSTANT (1) << shift) &&
-          value % (G_GUINT64_CONSTANT (1) << shift) == 0)
+      if (value > powers_of_1000[power] &&
+          value % powers_of_1000[power] == 0)
         break;
     }
 
-  if (shift != entry->shift)
-    gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (entry->menu), shift);
+  if (power != entry->power)
+    gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (entry->menu), power);
 
   gtk_adjustment_set_value (entry->adjustment,
                             (gdouble) gimp_memsize_entry_get_rounded_value (entry, value));
diff -urN gimp-2.10.38-orig/libgimpwidgets/gimpmemsizeentry.h gimp-2.10.38/libgimpwidgets/gimpmemsizeentry.h
--- gimp-2.10.38-orig/libgimpwidgets/gimpmemsizeentry.h	2024-05-03 09:33:35 +0900
+++ gimp-2.10.38/libgimpwidgets/gimpmemsizeentry.h	2024-06-23 22:27:54 +0900
@@ -48,7 +48,7 @@
   guint64        lower;
   guint64        upper;
 
-  guint          shift;
+  guint          power;
 
   GtkAdjustment *adjustment;
   GtkWidget     *spinbutton;
