[MERGED] osmo-ttcn3-hacks[master]: Helper functions in GSM_Tyes and Osmocom_Types

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Feb 25 16:09:47 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: Helper functions in GSM_Tyes and Osmocom_Types
......................................................................


Helper functions in GSM_Tyes and Osmocom_Types

Change-Id: Ibd8f215a7cd4564126503c3552bbcceb6d31c779
---
M library/GSM_Types.ttcn
M library/Osmocom_Types.ttcn
2 files changed, 24 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn
index 5884c27..b86bfd7 100644
--- a/library/GSM_Types.ttcn
+++ b/library/GSM_Types.ttcn
@@ -247,5 +247,10 @@
 	return GSM51_MFRAMES_PER_SEC * int2float(bs_ag_blks_res);
 }
 
+/* compute TC as per 45.002 6.3.1.3 */
+function f_gsm_compute_tc(integer fn) return integer {
+	return (fn / 51) mod 8;
+}
+
 
 } with { encode "RAW"; variant "FIELDORDER(msb)" }
diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn
index 713acc9..a6d5c82 100644
--- a/library/Osmocom_Types.ttcn
+++ b/library/Osmocom_Types.ttcn
@@ -99,5 +99,24 @@
 	self.stop;
 }
 
+type record of integer IntegerRecord;
+
+function int2bool(integer int) return boolean {
+	if (int != 0) {
+		return true;
+	} else {
+		return false;
+	}
+}
+
+function f_array_contains(IntegerRecord arr, integer key) return boolean {
+	for (var integer i:= 0; i< sizeof(arr); i := i + 1) {
+		if (arr[i] == key) {
+		return true;
+			}
+	}
+	return false;
+}
+
 
 } with { encode "RAW"; variant "FIELDORDER(msb)" }

-- 
To view, visit https://gerrit.osmocom.org/6903
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibd8f215a7cd4564126503c3552bbcceb6d31c779
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list