Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
BasedOnStyle: LLVM

AccessModifierOffset: -4

AlignConsecutiveMacros: true
AlignConsecutiveBitFields: true
AlignEscapedNewlines: Right

AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty

AlwaysBreakTemplateDeclarations: Yes

BinPackParameters: false

BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Never
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: false
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBraces: Custom

ColumnLimit: 80

IndentWidth: 4
IndentWrappedFunctionNames: true

Standard: c++17
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@

# added more linters
3a3df3fae1574558973e3829368dc8a7b9c76ad9

# Move to clang-format-22
85e977ffa438851fda6f9d2314810bca278998b1
7 changes: 0 additions & 7 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,5 @@ jobs:
codespell
pylint

- name: Set up clang-format
run: |
sudo apt-get install -y clang-format-18
sudo unlink /usr/bin/clang-format
sudo ln -s /usr/bin/clang-format-18 /usr/bin/clang-format
clang-format --version

- name: Run pre-commit checks
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ repos:
- id: black
exclude: "_vendored/conv_template.py"

- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v22.1.0
hooks:
- id: clang-format
args: ["-i"]
Expand Down
28 changes: 15 additions & 13 deletions mkl_umath/src/blocking_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@
static NPY_INLINE npy_intp npy_aligned_block_offset(const void *addr,
const npy_uintp esize,
const npy_uintp alignment,
const npy_uintp nvals) {
npy_uintp offset, peel;
const npy_uintp nvals)
{
npy_uintp offset, peel;

offset = (npy_uintp)addr & (alignment - 1);
peel = offset ? (alignment - offset) / esize : 0;
peel = (peel <= nvals) ? peel : nvals;
assert(peel <= NPY_MAX_INTP);
return (npy_intp)peel;
offset = (npy_uintp)addr & (alignment - 1);
peel = offset ? (alignment - offset) / esize : 0;
peel = (peel <= nvals) ? peel : nvals;
assert(peel <= NPY_MAX_INTP);
return (npy_intp)peel;
}

/*
Expand All @@ -75,11 +76,12 @@ static NPY_INLINE npy_intp npy_aligned_block_offset(const void *addr,
static NPY_INLINE npy_intp npy_blocked_end(const npy_uintp peel,
const npy_uintp esize,
const npy_uintp vsz,
const npy_uintp nvals) {
npy_uintp ndiff = nvals - peel;
npy_uintp res = (ndiff - ndiff % (vsz / esize));
const npy_uintp nvals)
{
npy_uintp ndiff = nvals - peel;
npy_uintp res = (ndiff - ndiff % (vsz / esize));

assert(nvals >= peel);
assert(res <= NPY_MAX_INTP);
return (npy_intp)(res);
assert(nvals >= peel);
assert(res <= NPY_MAX_INTP);
return (npy_intp)(res);
}
Loading
Loading