summaryrefslogtreecommitdiff
path: root/devel/rhtvision/files/patch-classes_tdesktop.cc
blob: 43e471b00062174dd0701735b8db714e50eca41d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--- classes/tdesktop.cc.orig	2017-08-18 14:40:03 UTC
+++ classes/tdesktop.cc
@@ -26,6 +26,11 @@ Modified cursor behavior while desktop locked by Salva
 #define Uses_TVCodePage
 #include <tv.h>
 
+inline unsigned int absdiff(unsigned int a, unsigned int b)
+{
+    return (a>=b)?a-b:b-a;
+}
+
 TDeskInit::TDeskInit( TBackground *(*cBackground)( TRect ) ) :
     createBackground( cBackground )
 {
@@ -144,7 +149,7 @@ unsigned iSqr( unsigned i )
 {
     unsigned res1 = 2;
     unsigned res2 = i/res1;
-    while( abs( res1 - res2 ) > 1 )
+    while( absdiff(res1,res2) > 1 )
         {
         res1 = (res1 + res2)/2;
         res2 = i/res1;