[PATCH v1] selftests:tdx:Use min macro

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

 



Using the min macro is usually more intuitive and readable.

Signed-off-by: Yan Zhen <yanzhen@xxxxxxxx>
---
 tools/testing/selftests/tdx/tdx_guest_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/tdx/tdx_guest_test.c b/tools/testing/selftests/tdx/tdx_guest_test.c
index 81d8cb88e..d7ddf5307 100644
--- a/tools/testing/selftests/tdx/tdx_guest_test.c
+++ b/tools/testing/selftests/tdx/tdx_guest_test.c
@@ -118,7 +118,7 @@ static void print_array_hex(const char *title, const char *prefix_str,
 	printf("\t\t%s", title);
 
 	for (j = 0; j < len; j += rowsize) {
-		line_len = rowsize < (len - j) ? rowsize : (len - j);
+		line_len = min((len - j), rowsize);
 		printf("%s%.8x:", prefix_str, j);
 		for (i = 0; i < line_len; i++)
 			printf(" %.2x", ptr[j + i]);
-- 
2.34.1





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux