Skip to content

Commit 1785342

Browse files
committed
add: bitsu{fx}
Signed-off-by: krishna2803 <[email protected]>
1 parent 24b27c8 commit 1785342

File tree

13 files changed

+286
-0
lines changed

13 files changed

+286
-0
lines changed

libc/src/stdfix/bitsuhk.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===-- Implementation of bitsuhk function -------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "bitsuhk.h"
10+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned short accum
11+
#include "include/llvm-libc-types/stdfix-types.h" // uint_uhk_t
12+
#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
13+
#include "src/__support/fixed_point/fx_bits.h" // fixed_point
14+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
15+
16+
namespace LIBC_NAMESPACE_DECL {
17+
18+
LLVM_LIBC_FUNCTION(uint_uhk_t, bitsuhk, (unsigned short accum f)) {
19+
return fixed_point::bitsfx<unsigned short accum, uint_uhk_t>(f);
20+
}
21+
22+
} // namespace LIBC_NAMESPACE_DECL

libc/src/stdfix/bitsuhk.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===-- Implementation header for bitsuhk function --------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_SRC_STDFIX_BITSUHK_H
10+
#define LLVM_LIBC_SRC_STDFIX_BITSUHK_H
11+
12+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned short accum
13+
#include "include/llvm-libc-types/stdfix-types.h" // uint_uhk_t
14+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
15+
16+
namespace LIBC_NAMESPACE_DECL {
17+
18+
uint_uhk_t bitsuhk(unsigned short accum f);
19+
20+
} // namespace LIBC_NAMESPACE_DECL
21+
22+
#endif // LLVM_LIBC_SRC_STDFIX_BITSUHK_H

libc/src/stdfix/bitsuhr.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===-- Implementation of bitsuhr function -------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "bitsuhr.h"
10+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned short fract
11+
#include "include/llvm-libc-types/stdfix-types.h" // uint_uhr_t
12+
#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
13+
#include "src/__support/fixed_point/fx_bits.h" // fixed_point
14+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
15+
16+
namespace LIBC_NAMESPACE_DECL {
17+
18+
LLVM_LIBC_FUNCTION(uint_uhr_t, bitsuhr, (unsigned short fract f)) {
19+
return fixed_point::bitsfx<unsigned short fract, uint_uhr_t>(f);
20+
}
21+
22+
} // namespace LIBC_NAMESPACE_DECL

libc/src/stdfix/bitsuhr.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===-- Implementation header for bitsuhr function --------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_SRC_STDFIX_BITSUHR_H
10+
#define LLVM_LIBC_SRC_STDFIX_BITSUHR_H
11+
12+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned short fract
13+
#include "include/llvm-libc-types/stdfix-types.h" // uint_uhr_t
14+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
15+
16+
namespace LIBC_NAMESPACE_DECL {
17+
18+
uint_uhr_t bitsuhr(unsigned short fract f);
19+
20+
} // namespace LIBC_NAMESPACE_DECL
21+
22+
#endif // LLVM_LIBC_SRC_STDFIX_BITSUHR_H

libc/src/stdfix/bitsuk.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===-- Implementation for bitsuk function -------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "bitsuk.h"
10+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned accum
11+
#include "include/llvm-libc-types/stdfix-types.h" // uint_uk_t
12+
#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
13+
#include "src/__support/fixed_point/fx_bits.h" // fixed_point
14+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
15+
16+
namespace LIBC_NAMESPACE_DECL {
17+
18+
LLVM_LIBC_FUNCTION(uint_uk_t, bitsuk, (unsigned accum f)) {
19+
return fixed_point::bitsfx<unsigned accum, uint_uk_t>(f);
20+
}
21+
22+
} // namespace LIBC_NAMESPACE_DECL

libc/src/stdfix/bitsuk.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===-- Implementation header for bitsuk function ---------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_SRC_STDFIX_BITSUK_H
10+
#define LLVM_LIBC_SRC_STDFIX_BITSUK_H
11+
12+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned accum
13+
#include "include/llvm-libc-types/stdfix-types.h" // uint_uk_t
14+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
15+
16+
namespace LIBC_NAMESPACE_DECL {
17+
18+
uint_uk_t bitsuk(unsigned accum f);
19+
20+
} // namespace LIBC_NAMESPACE_DECL
21+
22+
#endif // LLVM_LIBC_SRC_STDFIX_BITSUK_H

libc/src/stdfix/bitsulk.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===-- Implementation for bitsulk function ------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "bitsulk.h"
10+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned long accum
11+
#include "include/llvm-libc-types/stdfix-types.h" // uint_ulk_t
12+
#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
13+
#include "src/__support/fixed_point/fx_bits.h" // fixed_point
14+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
15+
16+
namespace LIBC_NAMESPACE_DECL {
17+
18+
LLVM_LIBC_FUNCTION(uint_ulk_t, bitsulk, (unsigned long accum f)) {
19+
return fixed_point::bitsfx<unsigned long accum, uint_ulk_t>(f);
20+
}
21+
22+
} // namespace LIBC_NAMESPACE_DECL

libc/src/stdfix/bitsulk.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===-- Implementation header for bitsulk function --------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_SRC_STDFIX_BITSLK_H
10+
#define LLVM_LIBC_SRC_STDFIX_BITSLK_H
11+
12+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned long accum
13+
#include "include/llvm-libc-types/stdfix-types.h" // uint_ulk_t
14+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
15+
16+
namespace LIBC_NAMESPACE_DECL {
17+
18+
uint_ulk_t bitsulk(unsigned long accum f);
19+
20+
} // namespace LIBC_NAMESPACE_DECL
21+
22+
#endif // LLVM_LIBC_SRC_STDFIX_BITSLK_H

libc/src/stdfix/bitsulr.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===-- Implementation of bitsulr function -------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "bitsulr.h"
10+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned long fract
11+
#include "include/llvm-libc-types/stdfix-types.h" // uint_ulr_t
12+
#include "src/__support/common.h" // LLVM_LIBC_FUNCTION
13+
#include "src/__support/fixed_point/fx_bits.h" // fixed_point
14+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
15+
16+
namespace LIBC_NAMESPACE_DECL {
17+
18+
LLVM_LIBC_FUNCTION(uint_ulr_t, bitsulr, (unsigned long fract f)) {
19+
return fixed_point::bitsfx<unsigned long fract, uint_ulr_t>(f);
20+
}
21+
22+
} // namespace LIBC_NAMESPACE_DECL

libc/src/stdfix/bitsulr.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===-- Implementation header for bitsulr function --------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_SRC_STDFIX_BITSULR_H
10+
#define LLVM_LIBC_SRC_STDFIX_BITSULR_H
11+
12+
#include "include/llvm-libc-macros/stdfix-macros.h" // unsigned long fract
13+
#include "include/llvm-libc-types/stdfix-types.h" // uint_ulr_t
14+
#include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
15+
16+
namespace LIBC_NAMESPACE_DECL {
17+
18+
uint_ulr_t bitsulr(unsigned long fract f);
19+
20+
} // namespace LIBC_NAMESPACE_DECL
21+
22+
#endif // LLVM_LIBC_SRC_STDFIX_BITSULR_H

0 commit comments

Comments
 (0)