Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/gfx/skia/skia/src/core/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  SkSafeRange.h   Sprache: C

 
/*
 * Copyright 2018 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */


#ifndef SkSafeRange_DEFINED
#define SkSafeRange_DEFINED

#include "include/core/SkTypes.h"

#include <cstdint>

// SkSafeRange always check that a series of operations are in-range.
// This check is sticky, so that if any one operation fails, the object will remember that and
// return false from ok().

class SkSafeRange {
public:
    explicit operator bool() const { return fOK; }

    bool ok() const { return fOK; }

    // checks 0 <= value <= max.
    // On success, returns value
    // On failure, returns 0 and sets ok() to false
    template <typename T> T checkLE(uint64_t value, T max) {
        SkASSERT(static_cast<int64_t>(max) >= 0);
        if (value > static_cast<uint64_t>(max)) {
            fOK = false;
            value = 0;
        }
        return static_cast<T>(value);
    }

    int checkGE(int value, int min) {
        if (value < min) {
            fOK = false;
            value = min;
        }
        return value;
    }

private:
    bool fOK = true;
};

#endif

Messung V0.5
C=91 H=100 G=95

¤ Dauer der Verarbeitung: 0.28 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.