This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// | |
| static inline int32_t mot_bitset_next(uint64_t* bitset) | |
| { | |
| const int32_t idx = (int32_t)mot_tzcnt64(*bitset); // trailing zero count | |
| *bitset &= (*bitset - 1); // clear lsb | |
| return idx; | |
| } | |
| typedef struct pos_comp_t { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static const double ref_u = 0.19783000664283680764; | |
| static const double ref_v = 0.46831999493879100370; | |
| static const double kappa = 903.29629629629629629630; | |
| static const double epsilon = 0.00885645167903563082; | |
| static const double xyz_to_rgb[9] = { | |
| 3.24096994190452134377, -1.53738317757009345794, -0.49861076029300328366, | |
| -0.96924363628087982613, 1.87596750150772066772, 0.04155505740717561247, | |
| 0.05563007969699360846, -0.20397695888897656435, 1.05697151424287856072, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define MAX_SIZE (64*1024) | |
| static struct my_data data[MAX_SIZE]; | |
| static short free_idx[MAX_SIZE]; | |
| static short first_free_idx = -1; | |
| // init; populate free items | |
| free_idx[MAX_SIZE-1] = -1; | |
| for (int i = 0; i < MAX_SIZE-1; ++i) { | |
| free_idx[i] = i+1; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Named color names (theme specific) | |
| enum MIcolorNames { | |
| MI_COLOR_NEUTRAL, | |
| MI_COLOR_ACCENT_A, | |
| }; | |
| // Tones per name (theme specific) | |
| enum MIcolorTone { | |
| MI_COLORTONE_50, | |
| MI_COLORTONE_75, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <vector> | |
| #include <span> | |
| #include <algorithm> | |
| // Based on | |
| // "An O(NP) Sequence Comparison Algorithm" by Sun Wu, Udi Manber and Gene Myers | |
| // - https://publications.mpi-cbg.de/Wu_1990_6334.pdf | |
| // - Good article visualizing Myer's older algorithm: https://epxx.co/artigos/diff_en.html | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| float evalCurve(float x, float tx, float ty, float sa, float sb) | |
| { | |
| const float EPS = 1e-6f; | |
| if (x < tx) { | |
| return (ty * x) / (x + sa * (tx - x) + EPS); | |
| } else { | |
| return ((1-ty) * (x-1)) / ((1-x) - sb * (tx - x) + EPS) + 1.0f; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "milayout.h" | |
| #include <stdlib.h> | |
| #include <stdarg.h> | |
| static float mi__minf(float a, float b) { return a < b ? a : b; } | |
| static float mi__maxf(float a, float b) { return a > b ? a : b; } | |
| static int mi__getGrow(MIbox* box, int main) | |
| { | |
| return box->content.xy[main] > 0 ? box->grow : (box->grow | 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Draws a graph using a triangle strip and simple gradient texture. | |
| // Anti-aliasing may be off by a half a pixel. | |
| // Works reasonable well with smooth as well as noisy data. | |
| // The basic idea is that we draw the graph using a full height quad (or two triangles) | |
| // per segment between two samples, and then we calculate texture coordinates | |
| // so that 1px anti-aliasing gradient passes through the data points. The texture coordinate | |
| // is calculated using the segment normal and one segment end point. | |
| struct Point { | |
| float x, y; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <vector> | |
| #include <span> | |
| #include <algorithm> | |
| // Based on | |
| // "An O(NP) Sequence Comparison Algorithm" by Sun Wu, Udi Manber and Gene Myers | |
| // - https://publications.mpi-cbg.de/Wu_1990_6334.pdf | |
| // - Good article visualizing Myer's older algorithm: https://epxx.co/artigos/diff_en.html | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <vector> | |
| #include <algorithm> | |
| // Based on "An O(NP) Sequence Comparison Algorithm" by Sun Wu, Udi Manber and Gene Myers | |
| struct Edit { | |
| enum Type { Insert, Delete, Common }; | |
| Edit() = default; | |
| Edit(Type _type, int _a, int _b, int _n) : type(_type), a(_a), b(_b), n(_n) {} |
NewerOlder