spl

systems programming language
git clone http://frotz.net/git/spl.git
Log | Files | Refs | README | LICENSE

stdlib.spl (438B)


      1 // Copyright 2023, Brian Swetland <swetland@frotz.net>
      2 // Licensed under the Apache License, Version 2.0.
      3 
      4 fn strneq(s1 str, s2 str, len u32) bool {
      5 	var n u32 = 0;
      6 	while n < len {
      7 		if s1[n] != s2[n] {
      8 			return false;
      9 		}
     10 		n++;
     11 	}
     12 	return true;
     13 }
     14 
     15 fn strcpyn(dst str, src str, len u32) {
     16 	var n u32 = 0;
     17 	while n < len {
     18 		dst[n] = src[n];
     19 		n++;
     20 	}
     21 }
     22 
     23 fn strlen(s str) u32 {
     24 	var n u32 = 0;
     25 	while s[n] != 0 {
     26 		n++;
     27 	}
     28 	return n;
     29 }