| 1 |
|
%% Copyright (c) 2022 Peter Morgan <peter.james.morgan@gmail.com> |
| 2 |
|
%% |
| 3 |
|
%% Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
|
%% you may not use this file except in compliance with the License. |
| 5 |
|
%% You may obtain a copy of the License at |
| 6 |
|
%% |
| 7 |
|
%% http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
|
%% |
| 9 |
|
%% Unless required by applicable law or agreed to in writing, software |
| 10 |
|
%% distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
|
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
|
%% See the License for the specific language governing permissions and |
| 13 |
|
%% limitations under the License. |
| 14 |
|
|
| 15 |
|
|
| 16 |
|
-module(mcd_util). |
| 17 |
|
|
| 18 |
|
|
| 19 |
|
-export([max/1]). |
| 20 |
|
-export([min/1]). |
| 21 |
|
-export([snake_case/1]). |
| 22 |
|
-export([split/1]). |
| 23 |
|
-include("mcd.hrl"). |
| 24 |
|
|
| 25 |
|
|
| 26 |
|
snake_case([_ | _] = Labels) -> |
| 27 |
:-( |
list_to_atom(lists:concat(lists:join("_", Labels))). |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
split(S) -> |
| 31 |
272 |
string:split(S, ?RN). |
| 32 |
|
|
| 33 |
|
|
| 34 |
:-( |
min(int8) -> -128; |
| 35 |
:-( |
min(int16) -> -32_768; |
| 36 |
:-( |
min(int32) -> -2_147_483_648; |
| 37 |
:-( |
min(int64) -> -9_223_372_036_854_775_808; |
| 38 |
|
|
| 39 |
:-( |
min(uint8) -> 0; |
| 40 |
:-( |
min(uint16) -> 0; |
| 41 |
:-( |
min(uint32) -> 0; |
| 42 |
12 |
min(uint64) -> 0. |
| 43 |
|
|
| 44 |
|
|
| 45 |
:-( |
max(int8) -> 127; |
| 46 |
:-( |
max(int16) -> 32_767; |
| 47 |
:-( |
max(int32) -> 2_147_483_647; |
| 48 |
3 |
max(int64) -> 9_223_372_036_854_775_807; |
| 49 |
|
|
| 50 |
:-( |
max(uint8) -> 255; |
| 51 |
:-( |
max(uint16) -> 65_535; |
| 52 |
7 |
max(uint32) -> 4_294_967_295; |
| 53 |
69 |
max(uint64) -> 18_446_744_073_709_551_615. |