summary refs log tree commit diff stats
path: root/lib/pure/bitops.nim
Commit message (Collapse)AuthorAgeFilesLines
* complete std prefixes for stdlib (#22887)ringabout2023-10-301-1/+1
| | | | follow up https://github.com/nim-lang/Nim/pull/22851 follow up https://github.com/nim-lang/Nim/pull/22873
* the compiler can be compiled with vcc (#22832)Juan M Gómez2023-10-161-1/+1
|
* fixes #22687; js backend - std/bitops/bitsliced throws compile error … ↵ringabout2023-09-211-1/+1
| | | | | | | (#22722) …in typeMasked fixes #22687
* fixes #21564; std/bitops: Add explicit type masking for the JS target (#21598)chmod2222023-04-031-3/+9
| | | | | | | | | | | | | | | | | | | * std/bitops: Add explicit type masking for the JS target Typecasts on the JavaScript backend do not function the same way as they do on C and C++ backends, so for bitwise operations we may need to mask them back down into their allowed range when they get shifted outside it. Since they do work as expected on the other backends, a default bitmask of all 1's is casted down into the target type as an easily optimizable "& 0xFF" operation for these backends. * Fixup: this should still be a func * Run test case on js target * Adapt testcase to contributor guide and best practices * Simplify constrain logic and turn into actual no-op for the C side
* typetraits: add toSigned, toUnsigned (#18445)Timothee Cour2022-04-071-17/+9
| | | | | | | | * typetraits: add toSigned, toUnsigned * improve and add tests Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: flywind <xzsflywind@gmail.com>
* renamed: lib/std/private/vmutils.nim -> lib/std/private/bitops_utils.nim ↵Timothee Cour2021-08-081-3/+1
| | | | to avoid confusion with unrelated std/vmutils (#18660)
* deprecate cuchar, don't redefine it (#18505)Andreas Rumpf2021-07-161-21/+21
|
* Rotation right and left refactored to generics. Continuation of #16622 (#17578)rockcavera2021-03-301-88/+31
| | | | | | | * Rotation right and left refactored to generics Continuation of [16622](https://github.com/nim-lang/Nim/pull/16622) * add runnableExamples
* follow up #17539 (#17548)flywind2021-03-291-1/+0
| | | | | * fix nim js cmp fails at CT * follow up #17539
* close #11330 sets uses optimized countSetBits (#17334)flywind2021-03-221-80/+8
| | | | | | | * Update lib/pure/bitops.nim * Update lib/system/sets.nim * Apply suggestions from code review Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* IC: green tests (#17311)Andreas Rumpf2021-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * IC: renamed to_packed_ast module to ic module * IC: don't store the --forceBuild flag, makes it easier to test * IC: enable hello world test * Codegen: refactorings for IC; changed the name mangling algorithm * fixed the HCR regressions * life is too short for HCR * tconvexhull is now allowed to use deepCopy * IC exposed a stdlib bug, required a refactoring * codegen: code cleanups * IC: even if a module is outdated, its dependencies might come from disk * IC: progress * IC: better name mangling, module IDs are not stable * IC: another refactoring helping with --ic:on --gc:arc * disable arraymancer on Windows for the time being * disable arraymancer altogether * IC: make basic test work with 'nim cpp' * IC: progress on --ic:on --gc:arc * wip; name mangling for type info
* remove all uses of condsyms symbols defined prior to bootstrap nim 0.20.0 ↵Timothee Cour2021-02-171-295/+294
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#16918) * nimNoArrayToCstringConversion deadcode * nimbabel deadcode * nimHasalignOf deadcode * nimvarargstyped deadcode * nimhygiene deadcode * nimNewTypedesc deadcode * nimlocks deadcode * nimHasCppDefine deadcode * nimHasRunnableExamples deadcode * nimHasNilChecks deadcode * nimSymKind deadcode * minor macros refactoring * nimVmEqIdent deadcode * nimNoNil deadcode * nimNoZeroTerminator deadcode * nimHasSymOwnerInMacro deadcode * nimVmExportFixed deadcode * nimNewRuntime deadcode * nimAshr deadcode * nimUncheckedArrayTyp deadcode * nimHasTypeof deadcode * nimErrorProcCanHaveBody deadcode * nimHasHotCodeReloading deadcode * nimHasSignatureHashInMacro deadcode * nimHasDefault deadcode * nimMacrosSizealignof deadcode
* Improve documentation for bitops (#16961)konsumlamm2021-02-151-128/+131
| | | | | | | | | | * Improve documentation for bitops Use func Use let in runnableExamples * Remove unnecessary tests Fix #7587
* Refactoring `bitops.rotateLeftBits()` and `bitops.rotateRightBits()`; adding ↵rockcavera2021-02-081-65/+223
| | | | | builtins and intrinsics. (#16622) Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* adding missing commas in std/bitops (#16520)rockcavera2020-12-301-5/+5
| | | adding missing commas between the importc and header pragmas of some procs.
* init checks and 'out' parameters (#14521)Andreas Rumpf2020-06-231-0/+2
| | | | | | | | | | | * I don't care about observable stores * enforce explicit initializations * cleaner code for the stdlib * stdlib: use explicit initializations * make tests green * algorithm.nim: set result explicitly * remove out parameters and bring the PR into a mergable state * updated the changelog
* Fix runnable examples for bitops (#14247)awr12020-05-061-3/+3
|
* Added bitslice operations for bitops (#14016)awr12020-05-061-21/+206
| | | | | | | | | | | | | | | | | | | | * added bit operations based on bit slices, clarified documentation, made non-mutating versions of mask ops * Added since annotations, some runnable examples * Added mask()/masked() functions, changed internal workings of mask ops to use new bit* funcs * Changelog updated for new bitops improvements * Reorganization, added runnable examples * Documentation adjustments * Add incltrl for since annotation * Fix masked() impl * Fix mask() return type * Don't call toUnsigned on already unsigned types * Remove improper `var T` for flipMasked() * Fix return types for flipMasked() * Slight syntactic cleanup for *masked ops * Added tests for bitslice operations, new mask() operation, non-mutating mask ops * Fix setmasked() var T issue * More comprehensive tests * Fix runnable example for bitsliced() * Fix runnable example for mask()
* Make bitand, bitor, bitxor varargs-friendly (#13985)awr12020-04-201-9/+26
| | | | | | | | * made bitand, bitor, bitxor varargs friendly * changed new bitops to macros * changed macro signature for consistency (this technically doesn't matter) * added tests * removed redundant assert * fix literal
* Add runnableExamples to bitops module (#13951)jiro2020-04-131-15/+143
| | | | | | | | | | | | | | | | | * doc: bitops: add runnableExamples * doc: bitops: add notes to documentation comments of macros * doc: bitops: add periods to documentation comments * doc: bitops: add static * Revert "doc: bitops: add static" This reverts commit 595ee134abcd451e73ddde963c1b3e49a275f2e5. * doc: bitops: add `var` to arguments of macros * doc: bitops: remove examples of testBit
* fix several typos in documentation and comments (#12553)Nindaleth2019-10-301-1/+1
|
* [backport] run nimpretty on os-related stuffnarimiran2019-09-301-32/+47
|
* Fix spellings (#12277) [backport]Federico Ceratto2019-09-271-1/+1
|
* styleCheck: make the compiler and large parts of the stdlib compatible with ↵Araq2019-07-101-48/+48
| | | | --styleCheck:error
* Bit operator names 2 (#11413)Arne Döring2019-06-061-0/+11
| | | | | | * add bit operator names * add test for bitop alias
* Enable range checking for unsigned integers (#11313)Oscar Nihlgård2019-05-251-0/+18
| | | | | | * Enable range checking for unsigned integers * Make the tests green
* code cleanup (#10874)Arne Döring2019-03-281-18/+6
|
* bitops: add reverseBits and test (#10835)Tomohiro2019-03-131-0/+45
|
* Remove varsilent-observer2019-03-051-1/+1
| | | Shouldn't testing bit require only immutable access? I think this is a typo
* Vm bitops fixes (#10520)Arne Döring2019-02-051-10/+17
|
* Added basic bit manipulation procs to bitops (#10338)Ico Doornekamp2019-01-231-1/+59
|
* bitops: add 'hamming weight' to the doc indexAraq2017-12-031-1/+1
|
* add bitops module for optimized bit manipulation. (#5201)Parashurama2017-03-141-0/+383