<commit_before>////
//    __|  |  | _ _| __  /  __|   \ |
//  \__ \  __ |   |     /   _|   .  |
//  ____/ _| _| ___| ____| ___| _|\_|
//
// Copyright (c) 2017 <NAME>
//
// This library is free software; you can redistribute and modify it
// under the terms of the MIT license. See LICENSE for details.
//

#ifndef zlayer_h
#define zlayer_h

typedef struct SHIZLayer {
    unsigned short depth: 16;
    unsigned short layer: 8;
} SHIZLayer;

extern SHIZLayer const SHIZLayerTop; // max
extern SHIZLayer const SHIZLayerBottom; // min

#define SHIZLayerMin 0
#define SHIZLayerMax 255 // UCHAR_MAX

#define SHIZLayerDepthMin 0
#define SHIZLayerDepthMax 65535 // USHRT_MAX

#define SHIZLayerDefault SHIZLayerBottom

static inline
SHIZLayer const
SHIZLayeredWithDepth(unsigned char const layer,
                     unsigned short const depth)
{
    SHIZLayer result;

    result.layer = layer;
    result.depth = depth;

    return result;
}

static inline
SHIZLayer const
SHIZLayered(unsigned char const layer)
{
    return SHIZLayeredWithDepth(layer, SHIZLayerDefault.depth);
}

static inline
SHIZLayer const
SHIZLayeredBelow(SHIZLayer const layer)
{
    SHIZLayer layer_below = layer;

    if (layer.depth > SHIZLayerDepthMin) {
        layer_below.depth = layer.depth - 1;
    } else if (layer.layer > SHIZLayerMin) {
        layer_below.layer = layer.layer - 1;
    }

    return layer_below;
}<commit_msg>Rename depth layering utility function<commit_after>////
//    __|  |  | _ _| __  /  __|   \ |
//  \__ \  __ |   |     /   _|   .  |
//  ____/ _| _| ___| ____| ___| _|\_|
//
// Copyright (c) 2017 <NAME>
//
// This library is free software; you can redistribute and modify it
// under the terms of the MIT license. See LICENSE for details.
//

#ifndef zlayer_h
#define zlayer_h

typedef struct SHIZLayer {
    unsigned short depth: 16;
    unsigned short layer: 8;
} SHIZLayer;

extern SHIZLayer const SHIZLayerTop; // max
extern SHIZLayer const SHIZLayerBottom; // min

#define SHIZLayerMin 0
#define SHIZLayerMax 255 // UCHAR_MAX

#define SHIZLayerDepthMin 0
#define SHIZLayerDepthMax 65535 // USHRT_MAX

#define SHIZLayerDefault SHIZLayerBottom

static inline
SHIZLayer const
SHIZLayeredAtDepth(unsigned char const layer,
                   unsigned short const depth)
{
    SHIZLayer result;

    result.layer = layer;
    result.depth = depth;

    return result;
}

static inline
SHIZLayer const
SHIZLayered(unsigned char const layer)
{
    return SHIZLayeredAtDepth(layer, SHIZLayerDefault.depth);
}

static inline
SHIZLayer const
SHIZLayeredBelow(SHIZLayer const layer)
{
    SHIZLayer layer_below = layer;

    if (layer.depth > SHIZLayerDepthMin) {
        layer_below.depth = layer.depth - 1;
    } else if (layer.layer > SHIZLayerMin) {
        layer_below.layer = layer.layer - 1;
    }

    return layer_below;
}
{'fraction_non_alphanumeric': 0.09325326739667962, 'fraction_numerical': 0.013422818791946308, 'mean_word_length': 2.9497907949790796, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4002517', 'n_tokens_mistral': 995, 'n_tokens_neox': 927, 'n_words': 256}