diff mbox series

[v2,1/2] shared/util: Add conversion function for 24 bits

Message ID 20210913201341.3515285-1-luiz.dentz@gmail.com
State Superseded
Headers show
Series [v2,1/2] shared/util: Add conversion function for 24 bits | expand

Commit Message

Luiz Augusto von Dentz Sept. 13, 2021, 8:13 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds get/put 24 bits variants.
---
 src/shared/util.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

Comments

bluez.test.bot@gmail.com Sept. 13, 2021, 8:36 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=546113

---Test result---

Test Summary:
CheckPatch                    PASS      0.50 seconds
GitLint                       PASS      0.20 seconds
Prep - Setup ELL              PASS      39.88 seconds
Build - Prep                  PASS      0.09 seconds
Build - Configure             PASS      6.99 seconds
Build - Make                  PASS      173.70 seconds
Make Check                    PASS      8.77 seconds
Make Distcheck                PASS      205.84 seconds
Build w/ext ELL - Configure   PASS      7.14 seconds
Build w/ext ELL - Make        PASS      164.39 seconds

Details
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf

##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration



---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz Sept. 15, 2021, 1 a.m. UTC | #2
Hi,

On Mon, Sep 13, 2021 at 1:36 PM <bluez.test.bot@gmail.com> wrote:
>

> This is automated email and please do not reply to this email!

>

> Dear submitter,

>

> Thank you for submitting the patches to the linux bluetooth mailing list.

> This is a CI test results with your patch series:

> PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=546113

>

> ---Test result---

>

> Test Summary:

> CheckPatch                    PASS      0.50 seconds

> GitLint                       PASS      0.20 seconds

> Prep - Setup ELL              PASS      39.88 seconds

> Build - Prep                  PASS      0.09 seconds

> Build - Configure             PASS      6.99 seconds

> Build - Make                  PASS      173.70 seconds

> Make Check                    PASS      8.77 seconds

> Make Distcheck                PASS      205.84 seconds

> Build w/ext ELL - Configure   PASS      7.14 seconds

> Build w/ext ELL - Make        PASS      164.39 seconds

>

> Details

> ##############################

> Test: CheckPatch - PASS

> Desc: Run checkpatch.pl script with rule in .checkpatch.conf

>

> ##############################

> Test: GitLint - PASS

> Desc: Run gitlint with rule in .gitlint

>

> ##############################

> Test: Prep - Setup ELL - PASS

> Desc: Clone, build, and install ELL

>

> ##############################

> Test: Build - Prep - PASS

> Desc: Prepare environment for build

>

> ##############################

> Test: Build - Configure - PASS

> Desc: Configure the BlueZ source tree

>

> ##############################

> Test: Build - Make - PASS

> Desc: Build the BlueZ source tree

>

> ##############################

> Test: Make Check - PASS

> Desc: Run 'make check'

>

> ##############################

> Test: Make Distcheck - PASS

> Desc: Run distcheck to check the distribution

>

> ##############################

> Test: Build w/ext ELL - Configure - PASS

> Desc: Configure BlueZ source with '--enable-external-ell' configuration

>

> ##############################

> Test: Build w/ext ELL - Make - PASS

> Desc: Build BlueZ source with '--enable-external-ell' configuration

>

>

>

> ---

> Regards,

> Linux Bluetooth


Pushed.

-- 
Luiz Augusto von Dentz
diff mbox series

Patch

diff --git a/src/shared/util.h b/src/shared/util.h
index 60908371d..ac70117ca 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -131,6 +131,20 @@  static inline uint16_t get_be16(const void *ptr)
 	return be16_to_cpu(get_unaligned((const uint16_t *) ptr));
 }
 
+static inline uint32_t get_le24(const void *ptr)
+{
+	const uint8_t *src = ptr;
+
+	return ((uint32_t)src[2] << 16) | get_le16(ptr);
+}
+
+static inline uint32_t get_be24(const void *ptr)
+{
+	const uint8_t *src = ptr;
+
+	return ((uint32_t)src[0] << 16) | get_be16(&src[1]);
+}
+
 static inline uint32_t get_le32(const void *ptr)
 {
 	return le32_to_cpu(get_unaligned((const uint32_t *) ptr));
@@ -161,6 +175,18 @@  static inline void put_be16(uint16_t val, const void *ptr)
 	put_unaligned(cpu_to_be16(val), (uint16_t *) ptr);
 }
 
+static inline void put_le24(uint32_t val, void *ptr)
+{
+	put_le16(val, ptr);
+	put_unaligned(val >> 16, (uint8_t *) ptr + 2);
+}
+
+static inline void put_be24(uint32_t val, void *ptr)
+{
+	put_unaligned(val >> 16, (uint8_t *) ptr + 2);
+	put_be16(val, ptr + 1);
+}
+
 static inline void put_le32(uint32_t val, void *dst)
 {
 	put_unaligned(cpu_to_le32(val), (uint32_t *) dst);