• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DemoBytom / DemoEngine / 17778636268

16 Sep 2025 08:48PM UTC coverage: 24.615%. Remained the same
17778636268

push

coveralls.net

web-flow
Merge pull request #450 from DemoBytom/dependabot/dotnet_sdk/develop/dotnet-sdk-9.0.305

Bump dotnet-sdk from 9.0.300 to 9.0.305

96 of 390 relevant lines covered (24.62%)

146584.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Demo.Engine.Core/Maths/Interop/RawBool.cs
1
// Copyright © Michał Dembski and contributors.
2
// Distributed under MIT license. See LICENSE file in the root for more information.
3

4
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
5
//
6
// Permission is hereby granted, free of charge, to any person obtaining a copy
7
// of this software and associated documentation files (the "Software"), to deal
8
// in the Software without restriction, including without limitation the rights
9
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
// copies of the Software, and to permit persons to whom the Software is
11
// furnished to do so, subject to the following conditions:
12
//
13
// The above copyright notice and this permission notice shall be included in
14
// all copies or substantial portions of the Software.
15
//
16
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
// THE SOFTWARE.
23

24
using System.Runtime.InteropServices;
25

26
namespace Demo.Engine.Core.Maths.Interop;
27

28
/// <summary>
29
///     A boolean value stored on 4 bytes (instead of 1 in .NET).
30
/// </summary>
31
[StructLayout(LayoutKind.Sequential, Size = 4)]
32
public readonly struct RawBool : IEquatable<RawBool>
33
{
34
    private readonly int _boolValue;
35

36
    public RawBool(bool boolValue)
37
        => _boolValue = boolValue
×
38
            ? 1
×
39
            : 0;
×
40

41
    public RawBool(int boolValue)
42
        => _boolValue = boolValue;
×
43

44
    public RawBool(uint boolValue)
45
        => _boolValue = (int)boolValue;
×
46

47
    public override bool Equals(object? obj)
48
        => obj switch
×
49
        {
×
50
            null => false,
×
51
            bool b => Equals(new RawBool(b)),
×
52
            RawBool rawBool => Equals(rawBool),
×
53
            int b => Equals(new RawBool(b)),
×
54
            uint b => Equals(new RawBool(b)),
×
55
            byte b => Equals(new RawBool(b)),
×
56
            sbyte b => Equals(new RawBool(b)),
×
57
            short b => Equals(new RawBool(b)),
×
58
            ushort b => Equals(new RawBool(b)),
×
59
            long b => Equals(new RawBool((int)b)),
×
60
            ulong b => Equals(new RawBool((uint)b)),
×
61
            _ => false
×
62
        };
×
63

64
    public bool Equals(RawBool other)
65
        => _boolValue != 0
×
66
        == (other._boolValue != 0);
×
67

68
    public override int GetHashCode()
69
        => _boolValue;
×
70

71
    public static bool operator ==(RawBool left, RawBool right)
72
        => left.Equals(right);
×
73

74
    public static bool operator !=(RawBool left, RawBool right)
75
        => !left.Equals(right);
×
76

77
    public static implicit operator bool(RawBool booleanValue)
78
        => booleanValue._boolValue != 0;
×
79

80
    public static implicit operator RawBool(bool boolValue)
81
        => new(boolValue);
×
82

83
    public static explicit operator int(RawBool booleanValue)
84
        => booleanValue._boolValue;
×
85

86
    public static explicit operator RawBool(int boolValue)
87
        => new(boolValue);
×
88

89
    public static explicit operator uint(RawBool booleanValue)
90
        => (uint)booleanValue._boolValue;
×
91

92
    public static explicit operator RawBool(uint boolValue)
93
        => new(boolValue);
×
94

95
    public override string ToString()
96
        => (_boolValue != 0).ToString();
×
97
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc