Browse Source

Merge branch 'master' of https://github.com/odin-lang/Odin

gingerBill 3 years ago
parent
commit
bb9c2f7aad
2 changed files with 7 additions and 4 deletions
  1. 4 1
      core/container/queue/queue.odin
  2. 3 3
      src/main.cpp

+ 4 - 1
core/container/queue/queue.odin

@@ -86,7 +86,8 @@ push_back :: proc(q: ^$Q/Queue($T), elem: T) -> bool {
 	if space(q^) == 0 {
 		_grow(q) or_return
 	}
-	q.data[q.len] = elem
+	idx := (q.offset+uint(q.len))%builtin.len(q.data)
+	q.data[idx] = elem
 	q.len += 1
 	return true
 }
@@ -126,6 +127,7 @@ pop_back_safe :: proc(q: ^$Q/Queue($T)) -> (elem: T, ok: bool) {
 pop_front :: proc(q: ^$Q/Queue($T), loc := #caller_location) -> (elem: T) {
 	assert(condition=q.len > 0, loc=loc)
 	elem = q.data[q.offset]
+	q.offset = (q.offset+1)%builtin.len(q.data)
 	q.len -= 1
 	return
 }
@@ -133,6 +135,7 @@ pop_front :: proc(q: ^$Q/Queue($T), loc := #caller_location) -> (elem: T) {
 pop_front_safe :: proc(q: ^$Q/Queue($T)) -> (elem: T, ok: bool) {
 	if q.len > 0 {
 		elem = q.data[q.offset]
+		q.offset = (q.offset+1)%builtin.len(q.data)
 		q.len -= 1
 		ok = true
 	}

+ 3 - 3
src/main.cpp

@@ -485,16 +485,16 @@ i32 linker_stage(lbGenerator *gen) {
 				// NOTE: If you change this (although this minimum is as low as you can go with Odin working)
 				//       make sure to also change the 'mtriple' param passed to 'opt'
 				#if defined(GB_CPU_ARM)
-				" -macosx_version_min 11.0.0 "
+				" -mmacosx-version-min=11.0.0 "
 				#else
-				" -macosx_version_min 10.8.0 "
+				" -mmacosx-version-min=10.8.0 "
 				#endif
 				// This points the linker to where the entry point is
 				" -e _main "
 			#endif
 			, object_files, LIT(output_base), LIT(output_ext),
 			#if defined(GB_SYSTEM_OSX)
-			  "-lSystem -lm -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/usr/local/lib",
+			  "-lSystem -lm -Wl,-syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/usr/local/lib",
 			#else
 			  "-lc -lm",
 			#endif