xref: /aosp_15_r20/external/erofs-utils/lib/uuid_unparse.c (revision 33b1fccf6a0fada2c2875d400ed01119b7676ee5)
1 // SPDX-License-Identifier: GPL-2.0+ OR Apache-2.0
2 /*
3  * Copyright (C) 2023 Norbert Lange <[email protected]>
4  */
5 
6 #include <stdio.h>
7 
8 #include "erofs/config.h"
9 #include "liberofs_uuid.h"
10 
erofs_uuid_unparse_lower(const unsigned char * buf,char * out)11 void erofs_uuid_unparse_lower(const unsigned char *buf, char *out) {
12 	sprintf(out, "%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
13 			(buf[0] << 8) | buf[1],
14 			(buf[2] << 8) | buf[3],
15 			(buf[4] << 8) | buf[5],
16 			(buf[6] << 8) | buf[7],
17 			(buf[8] << 8) | buf[9],
18 			(buf[10] << 8) | buf[11],
19 			(buf[12] << 8) | buf[13],
20 			(buf[14] << 8) | buf[15]);
21 }
22